| 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/common/system/chromeos/palette/palette_tray.h" | 5 #include "ash/common/system/chromeos/palette/palette_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_constants.h" | 7 #include "ash/common/shelf/shelf_constants.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/shelf/wm_shelf_util.h" | 9 #include "ash/common/shelf/wm_shelf_util.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // Predefined padding for the icon used in this tray. These are to be set to the | 36 // Predefined padding for the icon used in this tray. These are to be set to the |
| 37 // border of the icon, depending on the current |shelf_alignment()|. | 37 // border of the icon, depending on the current |shelf_alignment()|. |
| 38 const int kHorizontalShelfHorizontalPadding = 8; | 38 const int kHorizontalShelfHorizontalPadding = 8; |
| 39 const int kHorizontalShelfVerticalPadding = 4; | 39 const int kHorizontalShelfVerticalPadding = 4; |
| 40 const int kVerticalShelfHorizontalPadding = 2; | 40 const int kVerticalShelfHorizontalPadding = 2; |
| 41 const int kVerticalShelfVerticalPadding = 5; | 41 const int kVerticalShelfVerticalPadding = 5; |
| 42 | 42 |
| 43 // Width of the palette itself (dp). | 43 // Width of the palette itself (dp). |
| 44 const int kPaletteWidth = 360; | 44 const int kPaletteWidth = 360; |
| 45 | 45 |
| 46 // Size of icon in the shelf (dp). |
| 47 const int kShelfIconSize = 18; |
| 48 |
| 46 // Creates a separator. | 49 // Creates a separator. |
| 47 views::Separator* CreateSeparator(views::Separator::Orientation orientation) { | 50 views::Separator* CreateSeparator(views::Separator::Orientation orientation) { |
| 48 const int kSeparatorInset = 10; | 51 const int kSeparatorInset = 10; |
| 49 | 52 |
| 50 views::Separator* separator = | 53 views::Separator* separator = |
| 51 new views::Separator(views::Separator::HORIZONTAL); | 54 new views::Separator(views::Separator::HORIZONTAL); |
| 52 separator->SetColor(ash::kBorderDarkColor); | 55 separator->SetColor(ash::kBorderDarkColor); |
| 53 separator->SetBorder( | 56 separator->SetBorder( |
| 54 views::Border::CreateEmptyBorder(kSeparatorInset, 0, kSeparatorInset, 0)); | 57 views::Border::CreateEmptyBorder(kSeparatorInset, 0, kSeparatorInset, 0)); |
| 55 return separator; | 58 return separator; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding))); | 301 kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding))); |
| 299 } else { | 302 } else { |
| 300 icon_->SetBorder(views::Border::CreateEmptyBorder(gfx::Insets( | 303 icon_->SetBorder(views::Border::CreateEmptyBorder(gfx::Insets( |
| 301 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding))); | 304 kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding))); |
| 302 } | 305 } |
| 303 } | 306 } |
| 304 | 307 |
| 305 void PaletteTray::UpdateTrayIcon() { | 308 void PaletteTray::UpdateTrayIcon() { |
| 306 gfx::VectorIconId icon = palette_tool_manager_->GetActiveTrayIcon( | 309 gfx::VectorIconId icon = palette_tool_manager_->GetActiveTrayIcon( |
| 307 palette_tool_manager_->GetActiveTool(ash::PaletteGroup::MODE)); | 310 palette_tool_manager_->GetActiveTool(ash::PaletteGroup::MODE)); |
| 308 icon_->SetImage(CreateVectorIcon(icon, kShelfIconColor)); | 311 icon_->SetImage(CreateVectorIcon(icon, kShelfIconSize, kShelfIconColor)); |
| 309 } | 312 } |
| 310 | 313 |
| 311 void PaletteTray::UpdateIconVisibility() { | 314 void PaletteTray::UpdateIconVisibility() { |
| 312 if (!IsPaletteEnabled()) | 315 if (!IsPaletteEnabled()) |
| 313 return; | 316 return; |
| 314 | 317 |
| 315 SessionStateDelegate* session_state_delegate = | 318 SessionStateDelegate* session_state_delegate = |
| 316 WmShell::Get()->GetSessionStateDelegate(); | 319 WmShell::Get()->GetSessionStateDelegate(); |
| 317 | 320 |
| 318 SetVisible(!session_state_delegate->IsScreenLocked() && | 321 SetVisible(!session_state_delegate->IsScreenLocked() && |
| 319 session_state_delegate->GetSessionState() == | 322 session_state_delegate->GetSessionState() == |
| 320 SessionStateDelegate::SESSION_STATE_ACTIVE && | 323 SessionStateDelegate::SESSION_STATE_ACTIVE && |
| 321 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != | 324 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != |
| 322 LoginStatus::KIOSK_APP); | 325 LoginStatus::KIOSK_APP); |
| 323 } | 326 } |
| 324 | 327 |
| 325 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |