| 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 11 matching lines...) Expand all Loading... |
| 22 #include "ui/gfx/vector_icons_public.h" | 22 #include "ui/gfx/vector_icons_public.h" |
| 23 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
| 24 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 namespace tray { | 28 namespace tray { |
| 29 | 29 |
| 30 class DefaultTracingView : public ActionableView { | 30 class DefaultTracingView : public ActionableView { |
| 31 public: | 31 public: |
| 32 DefaultTracingView() { | 32 explicit DefaultTracingView(SystemTrayItem* owner) : ActionableView(owner) { |
| 33 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, | 33 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, |
| 34 kTrayPopupPaddingHorizontal, 0, | 34 kTrayPopupPaddingHorizontal, 0, |
| 35 kTrayPopupPaddingBetweenItems)); | 35 kTrayPopupPaddingBetweenItems)); |
| 36 | 36 |
| 37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 38 image_ = | 38 image_ = |
| 39 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); | 39 new FixedSizedImageView(0, GetTrayConstant(TRAY_POPUP_ITEM_HEIGHT)); |
| 40 if (!MaterialDesignController::UseMaterialDesignSystemIcons()) { | 40 if (!MaterialDesignController::UseMaterialDesignSystemIcons()) { |
| 41 // The icon doesn't change in non-md. | 41 // The icon doesn't change in non-md. |
| 42 image_->SetImage( | 42 image_->SetImage( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 // TODO(tdanderson): Update the icon used for tracing or remove it from | 68 // TODO(tdanderson): Update the icon used for tracing or remove it from |
| 69 // the system menu. See crbug.com/625691. | 69 // the system menu. See crbug.com/625691. |
| 70 image_->SetImage(CreateVectorIcon(gfx::VectorIconId::CODE, kMenuIconSize, | 70 image_->SetImage(CreateVectorIcon(gfx::VectorIconId::CODE, kMenuIconSize, |
| 71 style.GetForegroundColor())); | 71 style.GetForegroundColor())); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool PerformAction(const ui::Event& event) override { | 74 bool PerformAction(const ui::Event& event) override { |
| 75 WmShell::Get()->RecordUserMetricsAction( | 75 WmShell::Get()->RecordUserMetricsAction( |
| 76 UMA_STATUS_AREA_TRACING_DEFAULT_SELECTED); | 76 UMA_STATUS_AREA_TRACING_DEFAULT_SELECTED); |
| 77 WmShell::Get()->system_tray_delegate()->ShowChromeSlow(); | 77 WmShell::Get()->system_tray_delegate()->ShowChromeSlow(); |
| 78 CloseSystemBubble(); |
| 78 return true; | 79 return true; |
| 79 } | 80 } |
| 80 | 81 |
| 81 views::ImageView* image_; | 82 views::ImageView* image_; |
| 82 views::Label* label_; | 83 views::Label* label_; |
| 83 | 84 |
| 84 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); | 85 DISALLOW_COPY_AND_ASSIGN(DefaultTracingView); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace tray | 88 } // namespace tray |
| (...skipping 17 matching lines...) Expand all Loading... |
| 105 tray_view()->SetVisible(visible); | 106 tray_view()->SetVisible(visible); |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool TrayTracing::GetInitialVisibility() { | 109 bool TrayTracing::GetInitialVisibility() { |
| 109 return false; | 110 return false; |
| 110 } | 111 } |
| 111 | 112 |
| 112 views::View* TrayTracing::CreateDefaultView(LoginStatus status) { | 113 views::View* TrayTracing::CreateDefaultView(LoginStatus status) { |
| 113 CHECK(default_ == NULL); | 114 CHECK(default_ == NULL); |
| 114 if (tray_view() && tray_view()->visible()) | 115 if (tray_view() && tray_view()->visible()) |
| 115 default_ = new tray::DefaultTracingView(); | 116 default_ = new tray::DefaultTracingView(this); |
| 116 return default_; | 117 return default_; |
| 117 } | 118 } |
| 118 | 119 |
| 119 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { | 120 views::View* TrayTracing::CreateDetailedView(LoginStatus status) { |
| 120 return NULL; | 121 return NULL; |
| 121 } | 122 } |
| 122 | 123 |
| 123 void TrayTracing::DestroyDefaultView() { | 124 void TrayTracing::DestroyDefaultView() { |
| 124 default_ = NULL; | 125 default_ = NULL; |
| 125 } | 126 } |
| 126 | 127 |
| 127 void TrayTracing::DestroyDetailedView() {} | 128 void TrayTracing::DestroyDetailedView() {} |
| 128 | 129 |
| 129 void TrayTracing::OnTracingModeChanged(bool value) { | 130 void TrayTracing::OnTracingModeChanged(bool value) { |
| 130 SetTrayIconVisible(value); | 131 SetTrayIconVisible(value); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |