Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/shelf/shelf.h" | 5 #include "ash/shelf/shelf.h" |
| 6 #include "ash/shelf/shelf_layout_manager.h" | 6 #include "ash/shelf/shelf_layout_manager.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 aura::Window* ChromeVoxPanel::GetRootWindow() { | 102 aura::Window* ChromeVoxPanel::GetRootWindow() { |
| 103 return GetWidget()->GetNativeWindow()->GetRootWindow(); | 103 return GetWidget()->GetNativeWindow()->GetRootWindow(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ChromeVoxPanel::Close() { | 106 void ChromeVoxPanel::Close() { |
| 107 widget_->Close(); | 107 widget_->Close(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() { | 110 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() { |
| 111 widget_->Show(); | 111 widget_->Show(); |
| 112 ash::Shelf::ForWindow(GetRootWindow()) | 112 |
| 113 ->shelf_layout_manager() | 113 ash::Shelf* shelf = ash::Shelf::ForWindow(GetRootWindow()); |
| 114 ->SetChromeVoxPanelHeight(kPanelHeight); | 114 if (!shelf) |
| 115 return; | |
| 116 | |
| 117 ash::ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); | |
| 118 if (shelf_layout_manager) | |
| 119 shelf_layout_manager->SetChromeVoxPanelHeight(kPanelHeight); | |
|
xiyuan
2016/03/28 21:48:05
Do we need to worry about shelf not getting the co
dmazzoni
2016/03/28 22:29:11
Good catch, fixed.
| |
| 115 } | 120 } |
| 116 | 121 |
| 117 void ChromeVoxPanel::EnterFullscreen() { | 122 void ChromeVoxPanel::EnterFullscreen() { |
| 118 Focus(); | 123 Focus(); |
| 119 fullscreen_ = true; | 124 fullscreen_ = true; |
| 120 UpdateWidgetBounds(); | 125 UpdateWidgetBounds(); |
| 121 } | 126 } |
| 122 | 127 |
| 123 void ChromeVoxPanel::ExitFullscreen() { | 128 void ChromeVoxPanel::ExitFullscreen() { |
| 124 widget_->widget_delegate()->set_can_activate(false); | 129 widget_->widget_delegate()->set_can_activate(false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 uint32_t changed_metrics) { | 162 uint32_t changed_metrics) { |
| 158 UpdateWidgetBounds(); | 163 UpdateWidgetBounds(); |
| 159 } | 164 } |
| 160 | 165 |
| 161 void ChromeVoxPanel::UpdateWidgetBounds() { | 166 void ChromeVoxPanel::UpdateWidgetBounds() { |
| 162 gfx::Rect bounds(GetRootWindow()->bounds().size()); | 167 gfx::Rect bounds(GetRootWindow()->bounds().size()); |
| 163 if (!fullscreen_) | 168 if (!fullscreen_) |
| 164 bounds.set_height(kPanelHeight); | 169 bounds.set_height(kPanelHeight); |
| 165 widget_->SetBounds(bounds); | 170 widget_->SetBounds(bounds); |
| 166 } | 171 } |
| OLD | NEW |