| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/system/palette/common_palette_tool.h" | 5 #include "ash/system/palette/common_palette_tool.h" |
| 6 | 6 |
| 7 #include "ash/resources/grit/ash_resources.h" | 7 #include "ash/resources/grit/ash_resources.h" |
| 8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/system/palette/palette_ids.h" | 10 #include "ash/system/palette/palette_ids.h" |
| 11 #include "ash/system/palette/palette_tool_manager.h" | 11 #include "ash/system/palette/palette_tool_manager.h" |
| 12 #include "ash/system/tray/hover_highlight_view.h" | 12 #include "ash/system/tray/hover_highlight_view.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_popup_utils.h" | 14 #include "ash/system/tray/tray_popup_utils.h" |
| 15 #include "ash/system/tray/view_click_listener.h" | 15 #include "ash/system/tray/view_click_listener.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/color_palette.h" | 20 #include "ui/gfx/color_palette.h" |
| 21 #include "ui/gfx/paint_vector_icon.h" | 21 #include "ui/gfx/paint_vector_icon.h" |
| 22 #include "ui/views/border.h" | |
| 23 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
| 24 | 23 |
| 25 namespace ash { | 24 namespace ash { |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 void AddHistogramTimes(PaletteToolId id, base::TimeDelta duration) { | 27 void AddHistogramTimes(PaletteToolId id, base::TimeDelta duration) { |
| 29 if (id == PaletteToolId::LASER_POINTER) { | 28 if (id == PaletteToolId::LASER_POINTER) { |
| 30 UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", duration, | 29 UMA_HISTOGRAM_CUSTOM_TIMES("Ash.Shelf.Palette.InLaserPointerMode", duration, |
| 31 base::TimeDelta::FromMilliseconds(100), | 30 base::TimeDelta::FromMilliseconds(100), |
| 32 base::TimeDelta::FromHours(1), 50); | 31 base::TimeDelta::FromHours(1), 50); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 PaletteToolIdToPaletteModeCancelType(GetToolId(), | 72 PaletteToolIdToPaletteModeCancelType(GetToolId(), |
| 74 false /*is_switched*/)); | 73 false /*is_switched*/)); |
| 75 } else { | 74 } else { |
| 76 delegate()->EnableTool(GetToolId()); | 75 delegate()->EnableTool(GetToolId()); |
| 77 } | 76 } |
| 78 } | 77 } |
| 79 | 78 |
| 80 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { | 79 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { |
| 81 gfx::ImageSkia icon = | 80 gfx::ImageSkia icon = |
| 82 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); | 81 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); |
| 83 | |
| 84 highlight_view_ = new HoverHighlightView(this); | 82 highlight_view_ = new HoverHighlightView(this); |
| 85 highlight_view_->SetBorder(views::CreateEmptyBorder(0, 0, 0, 0)); | |
| 86 highlight_view_->AddIconAndLabel(icon, name); | 83 highlight_view_->AddIconAndLabel(icon, name); |
| 87 highlight_view_->set_custom_height(kMenuButtonSize); | |
| 88 | |
| 89 TrayPopupUtils::InitializeAsCheckableRow(highlight_view_, enabled()); | 84 TrayPopupUtils::InitializeAsCheckableRow(highlight_view_, enabled()); |
| 90 | |
| 91 return highlight_view_; | 85 return highlight_view_; |
| 92 } | 86 } |
| 93 | 87 |
| 94 } // namespace ash | 88 } // namespace ash |
| OLD | NEW |