Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/chromeos/accessibility/chromevox_panel.cc

Issue 2889673002: chromeos: Refactor shelf to create ShelfView earlier in startup (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/chromeos/accessibility/chromevox_panel.h" 5 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h"
6 6
7 #include "ash/accessibility_types.h" 7 #include "ash/accessibility_types.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void ChromeVoxPanel::Close() { 125 void ChromeVoxPanel::Close() {
126 widget_->Close(); 126 widget_->Close();
127 } 127 }
128 128
129 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() { 129 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() {
130 widget_->Show(); 130 widget_->Show();
131 UpdatePanelHeight(); 131 UpdatePanelHeight();
132 } 132 }
133 133
134 void ChromeVoxPanel::UpdatePanelHeight() { 134 void ChromeVoxPanel::UpdatePanelHeight() {
135 ash::WmShelf* shelf = 135 SendPanelHeightToAsh(kPanelHeight);
136 ash::WmShelf::ForWindow(ash::WmWindow::Get(GetRootWindow())); 136 }
137 if (!shelf->IsShelfInitialized())
138 return;
139 137
140 ash::ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); 138 void ChromeVoxPanel::ResetPanelHeight() {
141 if (shelf_layout_manager) 139 SendPanelHeightToAsh(0);
142 shelf_layout_manager->SetChromeVoxPanelHeight(kPanelHeight);
143 } 140 }
144 141
145 void ChromeVoxPanel::EnterFullscreen() { 142 void ChromeVoxPanel::EnterFullscreen() {
146 Focus(); 143 Focus();
147 panel_fullscreen_ = true; 144 panel_fullscreen_ = true;
148 UpdateWidgetBounds(); 145 UpdateWidgetBounds();
149 } 146 }
150 147
151 void ChromeVoxPanel::ExitFullscreen() { 148 void ChromeVoxPanel::ExitFullscreen() {
152 widget_->Deactivate(); 149 widget_->Deactivate();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // If we're in full-screen mode, give the panel a height of 0 unless 192 // If we're in full-screen mode, give the panel a height of 0 unless
196 // it's active. 193 // it's active.
197 if (ash::GetRootWindowController(GetRootWindow()) 194 if (ash::GetRootWindowController(GetRootWindow())
198 ->GetWindowForFullscreenMode() && 195 ->GetWindowForFullscreenMode() &&
199 !widget_->IsActive()) { 196 !widget_->IsActive()) {
200 bounds.set_height(0); 197 bounds.set_height(0);
201 } 198 }
202 199
203 widget_->SetBounds(bounds); 200 widget_->SetBounds(bounds);
204 } 201 }
202
203 void ChromeVoxPanel::SendPanelHeightToAsh(int panel_height) {
204 // WmShelf is available for the lifetime of the RootWindowController.
205 ash::RootWindowController* root_window_controller =
206 ash::RootWindowController::ForWindow(GetRootWindow());
207 if (!root_window_controller)
208 return;
209
210 // TODO(mash): Replace with shelf mojo API.
211 ash::ShelfLayoutManager* shelf_layout_manager =
212 root_window_controller->GetShelf()->shelf_layout_manager();
213 if (shelf_layout_manager)
214 shelf_layout_manager->SetChromeVoxPanelHeight(panel_height);
215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698