Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/system/chromeos/tray_tracing.h" | 5 #include "ash/common/system/chromeos/tray_tracing.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/metrics/user_metrics_action.h" | 8 #include "ash/common/metrics/user_metrics_action.h" |
| 9 #include "ash/common/system/tray/actionable_view.h" | 9 #include "ash/common/system/tray/actionable_view.h" |
| 10 #include "ash/common/system/tray/fixed_sized_image_view.h" | 10 #include "ash/common/system/tray/fixed_sized_image_view.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "ui/gfx/vector_icons_public.h" | 21 #include "ui/gfx/vector_icons_public.h" |
| 22 #include "ui/views/controls/image_view.h" | 22 #include "ui/views/controls/image_view.h" |
| 23 #include "ui/views/controls/label.h" | 23 #include "ui/views/controls/label.h" |
| 24 #include "ui/views/layout/box_layout.h" | 24 #include "ui/views/layout/box_layout.h" |
| 25 | 25 |
| 26 namespace ash { | 26 namespace ash { |
| 27 namespace tray { | 27 namespace tray { |
| 28 | 28 |
| 29 class DefaultTracingView : public ActionableView { | 29 class DefaultTracingView : public ActionableView { |
| 30 public: | 30 public: |
| 31 DefaultTracingView() { | 31 DefaultTracingView(SystemTrayItem* owner) : ActionableView(owner) { |
|
James Cook
2016/09/22 21:17:16
explicit
oshima
2016/09/23 09:37:19
Done.
| |
| 32 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 32 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 33 kTrayPopupPaddingHorizontal, 0, | 33 kTrayPopupPaddingHorizontal, 0, |
| 34 kTrayPopupPaddingBetweenItems)); | 34 kTrayPopupPaddingBetweenItems)); |
| 35 | 35 |
| 36 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 36 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 37 image_ = | 37 image_ = |
| 38 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); | 38 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); |
| 39 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { | 39 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { |
| 40 // TODO(tdanderson): Update the icon used for tracing or remove it from | 40 // TODO(tdanderson): Update the icon used for tracing or remove it from |
| 41 // the system menu. See crbug.com/625691. | 41 // the system menu. See crbug.com/625691. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 55 } | 55 } |
| 56 | 56 |
| 57 ~DefaultTracingView() override {} | 57 ~DefaultTracingView() override {} |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 // Overridden from ActionableView. | 60 // Overridden from ActionableView. |
| 61 bool PerformAction(const ui::Event& event) override { | 61 bool PerformAction(const ui::Event& event) override { |
| 62 WmShell::Get()->RecordUserMetricsAction( | 62 WmShell::Get()->RecordUserMetricsAction( |
| 63 UMA_STATUS_AREA_TRACING_DEFAULT_SELECTED); | 63 UMA_STATUS_AREA_TRACING_DEFAULT_SELECTED); |
| 64 WmShell::Get()->system_tray_delegate()->ShowChromeSlow(); | 64 WmShell::Get()->system_tray_delegate()->ShowChromeSlow(); |
| 65 CloseSystemBubble(); | |
| 65 return true; | 66 return true; |
| 66 } | 67 } |
| 67 | 68 |
| 68 views::ImageView* image_; | 69 views::ImageView* image_; |
| 69 views::Label* label_; | 70 views::Label* label_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); | 72 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace tray | 75 } // namespace tray |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 92 tray_view()->SetVisible(visible); | 93 tray_view()->SetVisible(visible); |
| 93 } | 94 } |
| 94 | 95 |
| 95 bool TrayTracing::GetInitialVisibility() { | 96 bool TrayTracing::GetInitialVisibility() { |
| 96 return false; | 97 return false; |
| 97 } | 98 } |
| 98 | 99 |
| 99 views::View* TrayTracing::CreateDefaultView(LoginStatus status) { | 100 views::View* TrayTracing::CreateDefaultView(LoginStatus status) { |
| 100 CHECK(default_ == NULL); | 101 CHECK(default_ == NULL); |
| 101 if (tray_view() && tray_view()->visible()) | 102 if (tray_view() && tray_view()->visible()) |
| 102 default_ = new tray::DefaultTracingView(); | 103 default_ = new tray::DefaultTracingView(this); |
| 103 return default_; | 104 return default_; |
| 104 } | 105 } |
| 105 | 106 |
| 106 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { | 107 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { |
| 107 return NULL; | 108 return NULL; |
| 108 } | 109 } |
| 109 | 110 |
| 110 void TrayTracing::DestroyDefaultView() { | 111 void TrayTracing::DestroyDefaultView() { |
| 111 default_ = NULL; | 112 default_ = NULL; |
| 112 } | 113 } |
| 113 | 114 |
| 114 void TrayTracing::DestroyDetailedView() {} | 115 void TrayTracing::DestroyDetailedView() {} |
| 115 | 116 |
| 116 void TrayTracing::OnTracingModeChanged(bool value) { | 117 void TrayTracing::OnTracingModeChanged(bool value) { |
| 117 SetTrayIconVisible(value); | 118 SetTrayIconVisible(value); |
| 118 } | 119 } |
| 119 | 120 |
| 120 } // namespace ash | 121 } // namespace ash |
| OLD | NEW |