Skip to content

Commit

Permalink
Eliminate some usage of "namespace tray" in //ash/system
Browse files Browse the repository at this point in the history
The nested namespace ash::tray is used inconsistently. The majority of
code is in namespace ash. Remove some usage of namespace tray.

This fixes most classes other than a11y, network, and bluetooth. Those
will be done in follow-up CLs, to keep the CLs small.

No behavior changes, just cleanup.

Bug: none
Change-Id: I50b9d1696532e4ec441aff434635bce0d29427b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3566441
Reviewed-by: Alex Newcomer <newcomer@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/main@{#988175}
  • Loading branch information
James Cook authored and Chromium LUCI CQ committed Apr 1, 2022
1 parent f8233ca commit 8f37fb3
Show file tree
Hide file tree
Showing 32 changed files with 42 additions and 107 deletions.
6 changes: 3 additions & 3 deletions ash/ambient/ui/glanceable_info_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ void GlanceableInfoView::InitLayout() {
gfx::ShadowValue::GetMargin(ambient::util::GetTextShadowValues(nullptr));

// Inits the time view.
time_view_ = AddChildView(std::make_unique<tray::TimeView>(
ash::tray::TimeView::ClockLayout::HORIZONTAL_CLOCK,
Shell::Get()->system_tray_model()->clock()));
time_view_ = AddChildView(
std::make_unique<TimeView>(TimeView::ClockLayout::HORIZONTAL_CLOCK,
Shell::Get()->system_tray_model()->clock()));
gfx::FontList time_font_list = GetTimeFontList(time_font_size_dip_);
time_view_->SetTextFont(time_font_list);
time_view_->SetTextColor(time_temperature_font_color_,
Expand Down
7 changes: 2 additions & 5 deletions ash/ambient/ui/glanceable_info_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ class Label;

namespace ash {

namespace tray {
class TimeView;
}

class AmbientViewDelegate;
class TimeView;

// Container for displaying a glanceable clock and weather info.
class GlanceableInfoView : public views::View,
Expand Down Expand Up @@ -51,7 +48,7 @@ class GlanceableInfoView : public views::View,
std::u16string GetTemperatureText() const;

// View for the time info. Owned by the view hierarchy.
ash::tray::TimeView* time_view_ = nullptr;
TimeView* time_view_ = nullptr;

// Views for weather icon and temperature.
views::ImageView* weather_condition_icon_ = nullptr;
Expand Down
5 changes: 1 addition & 4 deletions ash/system/audio/audio_detailed_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ constexpr auto kToggleButtonRowLabelPadding = gfx::Insets::TLBR(16, 0, 15, 0);
constexpr auto kToggleButtonRowViewPadding = gfx::Insets::TLBR(0, 56, 8, 0);

// This callback is only used for tests.
tray::AudioDetailedView::NoiseCancellationCallback*
AudioDetailedView::NoiseCancellationCallback*
g_noise_cancellation_toggle_callback = nullptr;

std::u16string GetAudioDeviceName(const AudioDevice& device) {
Expand Down Expand Up @@ -90,8 +90,6 @@ speech::LanguageCode GetLiveCaptionLocale() {

} // namespace

namespace tray {

AudioDetailedView::AudioDetailedView(DetailedViewDelegate* delegate)
: TrayDetailedView(delegate) {
CreateItems();
Expand Down Expand Up @@ -391,5 +389,4 @@ void AudioDetailedView::MaybeShowSodaMessage(speech::LanguageCode language_code,
}
}

} // namespace tray
} // namespace ash
11 changes: 4 additions & 7 deletions ash/system/audio/audio_detailed_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ class MicGainSliderController;
class UnifiedAudioDetailedViewControllerSodaTest;
class UnifiedAudioDetailedViewControllerTest;

namespace tray {

class ASH_EXPORT AudioDetailedView : public TrayDetailedView,
public ::ash::AccessibilityObserver,
public AccessibilityObserver,
public speech::SodaInstaller::Observer {
public:
explicit AudioDetailedView(DetailedViewDelegate* delegate);
Expand All @@ -50,12 +48,12 @@ class ASH_EXPORT AudioDetailedView : public TrayDetailedView,
static void SetMapNoiseCancellationToggleCallbackForTest(
NoiseCancellationCallback* map_noise_cancellation_toggle_callback);

// ::ash::AccessibilityObserver:
// AccessibilityObserver:
void OnAccessibilityStatusChanged() override;

private:
friend class ::ash::UnifiedAudioDetailedViewControllerSodaTest;
friend class ::ash::UnifiedAudioDetailedViewControllerTest;
friend class UnifiedAudioDetailedViewControllerSodaTest;
friend class UnifiedAudioDetailedViewControllerTest;

// Helper function to add non-clickable header rows within the scrollable
// list.
Expand Down Expand Up @@ -93,7 +91,6 @@ class ASH_EXPORT AudioDetailedView : public TrayDetailedView,
HoverHighlightView* live_caption_view_ = nullptr;
};

} // namespace tray
} // namespace ash

#endif // ASH_SYSTEM_AUDIO_AUDIO_DETAILED_VIEW_H_
2 changes: 1 addition & 1 deletion ash/system/audio/unified_audio_detailed_view_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ UnifiedAudioDetailedViewController::~UnifiedAudioDetailedViewController() {

views::View* UnifiedAudioDetailedViewController::CreateView() {
DCHECK(!view_);
view_ = new tray::AudioDetailedView(detailed_view_delegate_.get());
view_ = new AudioDetailedView(detailed_view_delegate_.get());
view_->Update();
return view_;
}
Expand Down
5 changes: 1 addition & 4 deletions ash/system/audio/unified_audio_detailed_view_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@

namespace ash {

namespace tray {
class AudioDetailedView;
} // namespace tray

class DetailedViewDelegate;
class UnifiedSystemTrayController;

Expand Down Expand Up @@ -47,7 +44,7 @@ class ASH_EXPORT UnifiedAudioDetailedViewController
private:
const std::unique_ptr<DetailedViewDelegate> detailed_view_delegate_;

tray::AudioDetailedView* view_ = nullptr;
AudioDetailedView* view_ = nullptr;
};

} // namespace ash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class UnifiedAudioDetailedViewControllerTest : public AshTestBase {
base::BindRepeating(&UnifiedAudioDetailedViewControllerTest::
AddViewToNoiseCancellationToggleMap,
base::Unretained(this));
tray::AudioDetailedView::SetMapNoiseCancellationToggleCallbackForTest(
AudioDetailedView::SetMapNoiseCancellationToggleCallbackForTest(
&noise_cancellation_toggle_callback_);
}

Expand Down Expand Up @@ -173,11 +173,10 @@ class UnifiedAudioDetailedViewControllerTest : public AshTestBase {
return chromeos::FakeCrasAudioClient::Get();
}

tray::AudioDetailedView* audio_detailed_view() {
AudioDetailedView* audio_detailed_view() {
if (!audio_detailed_view_) {
audio_detailed_view_ =
base::WrapUnique(static_cast<tray::AudioDetailedView*>(
audio_detailed_view_controller_->CreateView()));
audio_detailed_view_ = base::WrapUnique(static_cast<AudioDetailedView*>(
audio_detailed_view_controller_->CreateView()));
}
return audio_detailed_view_.get();
}
Expand All @@ -193,7 +192,7 @@ class UnifiedAudioDetailedViewControllerTest : public AshTestBase {
std::map<uint64_t, views::View*> sliders_map_;
std::map<uint64_t, views::View*> toggles_map_;
MicGainSliderController::MapDeviceSliderCallback map_device_sliders_callback_;
tray::AudioDetailedView::NoiseCancellationCallback
AudioDetailedView::NoiseCancellationCallback
noise_cancellation_toggle_callback_;
CrasAudioHandler* cras_audio_handler_ = nullptr; // Not owned.
scoped_refptr<AudioDevicesPrefHandlerStub> audio_pref_handler_;
Expand All @@ -202,7 +201,7 @@ class UnifiedAudioDetailedViewControllerTest : public AshTestBase {
scoped_refptr<UnifiedSystemTrayModel> tray_model_;
std::unique_ptr<UnifiedSystemTrayController> tray_controller_;
base::test::ScopedFeatureList scoped_feature_list_;
std::unique_ptr<tray::AudioDetailedView> audio_detailed_view_;
std::unique_ptr<AudioDetailedView> audio_detailed_view_;
};

TEST_F(UnifiedAudioDetailedViewControllerTest, OnlyOneVisibleSlider) {
Expand Down
3 changes: 0 additions & 3 deletions ash/system/cast/tray_cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const gfx::VectorIcon& SinkIconTypeToIcon(SinkIconType icon_type) {

} // namespace

namespace tray {

CastDetailedView::CastDetailedView(DetailedViewDelegate* delegate)
: TrayDetailedView(delegate) {
CreateItems();
Expand Down Expand Up @@ -148,5 +146,4 @@ void CastDetailedView::HandleViewClicked(views::View* view) {
}
}

} // namespace tray
} // namespace ash
2 changes: 0 additions & 2 deletions ash/system/cast/tray_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "ash/system/tray/tray_detailed_view.h"

namespace ash {
namespace tray {

// This view displays a list of cast receivers that can be clicked on and casted
// to. It is activated by clicking on the chevron inside of
Expand Down Expand Up @@ -50,7 +49,6 @@ class CastDetailedView : public TrayDetailedView,
views::View* add_access_code_device_ = nullptr;
};

} // namespace tray
} // namespace ash

#endif // ASH_SYSTEM_CAST_TRAY_CAST_H_
2 changes: 1 addition & 1 deletion ash/system/cast/unified_cast_detailed_view_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ UnifiedCastDetailedViewController::~UnifiedCastDetailedViewController() =

views::View* UnifiedCastDetailedViewController::CreateView() {
DCHECK(!view_);
view_ = new tray::CastDetailedView(detailed_view_delegate_.get());
view_ = new CastDetailedView(detailed_view_delegate_.get());
return view_;
}

Expand Down
6 changes: 2 additions & 4 deletions ash/system/cast/unified_cast_detailed_view_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
#include "ash/system/unified/detailed_view_controller.h"

namespace ash {
namespace tray {
class CastDetailedView;
} // namespace tray

class CastDetailedView;
class DetailedViewDelegate;
class UnifiedSystemTrayController;

Expand All @@ -36,7 +34,7 @@ class UnifiedCastDetailedViewController : public DetailedViewController {
private:
const std::unique_ptr<DetailedViewDelegate> detailed_view_delegate_;

tray::CastDetailedView* view_ = nullptr;
CastDetailedView* view_ = nullptr;
};

} // namespace ash
Expand Down
4 changes: 0 additions & 4 deletions ash/system/ime/tray_ime_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

namespace ash {

namespace tray {

IMEDetailedView::IMEDetailedView(DetailedViewDelegate* delegate,
ImeControllerImpl* ime_controller)
: ImeListView(delegate), ime_controller_(ime_controller) {
Expand Down Expand Up @@ -83,6 +81,4 @@ void IMEDetailedView::ShowSettings() {
BEGIN_METADATA(IMEDetailedView, ImeListView)
END_METADATA

} // namespace tray

} // namespace ash
4 changes: 0 additions & 4 deletions ash/system/ime/tray_ime_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class ImageView;
namespace ash {
class ImeControllerImpl;

namespace tray {

// A list of available IMEs shown in the IME detailed view of the system menu,
// along with other items in the title row (a settings button and optional
// enterprise-controlled icon).
Expand Down Expand Up @@ -58,8 +56,6 @@ class IMEDetailedView : public ImeListView {
views::ImageView* controlled_setting_icon_ = nullptr;
};

} // namespace tray

} // namespace ash

#endif // ASH_SYSTEM_IME_TRAY_IME_CHROMEOS_H_
4 changes: 2 additions & 2 deletions ash/system/ime/unified_ime_detailed_view_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ UnifiedIMEDetailedViewController::~UnifiedIMEDetailedViewController() {

views::View* UnifiedIMEDetailedViewController::CreateView() {
DCHECK(!view_);
view_ = new tray::IMEDetailedView(detailed_view_delegate_.get(),
Shell::Get()->ime_controller());
view_ = new IMEDetailedView(detailed_view_delegate_.get(),
Shell::Get()->ime_controller());
view_->Init(ShouldShowKeyboardToggle(), GetSingleImeBehavior());
return view_;
}
Expand Down
6 changes: 2 additions & 4 deletions ash/system/ime/unified_ime_detailed_view_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
#include "ash/system/virtual_keyboard/virtual_keyboard_observer.h"

namespace ash {
namespace tray {
class IMEDetailedView;
} // namespace tray

class DetailedViewDelegate;
class IMEDetailedView;
class UnifiedSystemTrayController;

// Controller of IME detailed view in UnifiedSystemTray.
Expand Down Expand Up @@ -57,7 +55,7 @@ class UnifiedIMEDetailedViewController : public DetailedViewController,

const std::unique_ptr<DetailedViewDelegate> detailed_view_delegate_;

tray::IMEDetailedView* view_ = nullptr;
IMEDetailedView* view_ = nullptr;

bool keyboard_suppressed_ = false;
};
Expand Down
7 changes: 2 additions & 5 deletions ash/system/locale/locale_detailed_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LocaleItem : public ActionableView {
public:
METADATA_HEADER(LocaleItem);

LocaleItem(tray::LocaleDetailedView* locale_detailed_view,
LocaleItem(LocaleDetailedView* locale_detailed_view,
const std::string& iso_code,
const std::u16string& display_name,
bool checked)
Expand Down Expand Up @@ -109,7 +109,7 @@ class LocaleItem : public ActionableView {
}

private:
tray::LocaleDetailedView* locale_detailed_view_;
LocaleDetailedView* locale_detailed_view_;
const bool checked_;
};

Expand All @@ -118,8 +118,6 @@ END_METADATA

} // namespace

namespace tray {

LocaleDetailedView::LocaleDetailedView(DetailedViewDelegate* delegate)
: TrayDetailedView(delegate) {
CreateItems();
Expand Down Expand Up @@ -162,5 +160,4 @@ void LocaleDetailedView::HandleViewClicked(views::View* view) {
BEGIN_METADATA(LocaleDetailedView, TrayDetailedView)
END_METADATA

} // namespace tray
} // namespace ash
2 changes: 0 additions & 2 deletions ash/system/locale/locale_detailed_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "ui/base/metadata/metadata_header_macros.h"

namespace ash {
namespace tray {

// The detailed view to show when the locale feature button is clicked.
class LocaleDetailedView : public TrayDetailedView {
Expand All @@ -34,7 +33,6 @@ class LocaleDetailedView : public TrayDetailedView {
base::flat_map<int, std::string> id_to_locale_;
};

} // namespace tray
} // namespace ash

#endif // ASH_SYSTEM_LOCALE_LOCALE_DETAILED_VIEW_H_
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ UnifiedLocaleDetailedViewController::~UnifiedLocaleDetailedViewController() =

views::View* UnifiedLocaleDetailedViewController::CreateView() {
DCHECK(!view_);
view_ = new tray::LocaleDetailedView(detailed_view_delegate_.get());
view_ = new LocaleDetailedView(detailed_view_delegate_.get());
return view_;
}

Expand Down
7 changes: 2 additions & 5 deletions ash/system/locale/unified_locale_detailed_view_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@

namespace ash {

namespace tray {
class LocaleDetailedView;
} // namespace tray

class DetailedViewDelegate;
class LocaleDetailedView;
class UnifiedSystemTrayController;

// Controller of the locale detailed view in UnifiedSystemTray.
Expand All @@ -38,7 +35,7 @@ class UnifiedLocaleDetailedViewController : public DetailedViewController {
private:
const std::unique_ptr<DetailedViewDelegate> detailed_view_delegate_;

tray::LocaleDetailedView* view_ = nullptr;
LocaleDetailedView* view_ = nullptr;
};

} // namespace ash
Expand Down
3 changes: 0 additions & 3 deletions ash/system/power/tray_power.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ using message_center::Notification;

namespace ash {

namespace tray {

PowerTrayView::PowerTrayView(Shelf* shelf) : TrayItemView(shelf) {
CreateImageView();
UpdateStatus();
Expand Down Expand Up @@ -130,5 +128,4 @@ void PowerTrayView::UpdateImage(bool icon_color_changed) {
info, kUnifiedTrayBatteryIconSize, icon_bg_color, icon_fg_color));
}

} // namespace tray
} // namespace ash

0 comments on commit 8f37fb3

Please sign in to comment.