| 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/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 | 152 |
| 153 PaletteTray::PaletteTray(WmShelf* wm_shelf) | 153 PaletteTray::PaletteTray(WmShelf* wm_shelf) |
| 154 : TrayBackgroundView(wm_shelf), | 154 : TrayBackgroundView(wm_shelf), |
| 155 palette_tool_manager_(new PaletteToolManager(this)), | 155 palette_tool_manager_(new PaletteToolManager(this)), |
| 156 weak_factory_(this) { | 156 weak_factory_(this) { |
| 157 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); | 157 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); |
| 158 | 158 |
| 159 if (MaterialDesignController::IsShelfMaterial()) { | 159 if (MaterialDesignController::IsShelfMaterial()) |
| 160 SetInkDropMode(InkDropMode::ON); | 160 SetInkDropMode(InkDropMode::ON); |
| 161 SetContentsBackground(false); | 161 SetContentsBackground(); |
| 162 } else { | |
| 163 SetContentsBackground(true); | |
| 164 } | |
| 165 | 162 |
| 166 SetLayoutManager(new views::FillLayout()); | 163 SetLayoutManager(new views::FillLayout()); |
| 167 icon_ = new views::ImageView(); | 164 icon_ = new views::ImageView(); |
| 168 UpdateTrayIcon(); | 165 UpdateTrayIcon(); |
| 169 | 166 |
| 170 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset); | 167 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset); |
| 171 tray_container()->AddChildView(icon_); | 168 tray_container()->AddChildView(icon_); |
| 172 | 169 |
| 173 WmShell::Get()->AddShellObserver(this); | 170 WmShell::Get()->AddShellObserver(this); |
| 174 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); | 171 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 UpdateIconVisibility(); | 427 UpdateIconVisibility(); |
| 431 } | 428 } |
| 432 } | 429 } |
| 433 | 430 |
| 434 void PaletteTray::UpdateIconVisibility() { | 431 void PaletteTray::UpdateIconVisibility() { |
| 435 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 432 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 436 IsInUserSession()); | 433 IsInUserSession()); |
| 437 } | 434 } |
| 438 | 435 |
| 439 } // namespace ash | 436 } // namespace ash |
| OLD | NEW |