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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 #include "ash/shelf/shelf.h" | 6 #include "ash/shelf/shelf.h" |
7 #include "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
12 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h" | 12 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h" |
13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "extensions/browser/view_type_utils.h" | 16 #include "extensions/browser/view_type_utils.h" |
17 #include "ui/chromeos/accessibility_types.h" | 17 #include "ui/chromeos/accessibility_types.h" |
| 18 #include "ui/display/screen.h" |
18 #include "ui/views/controls/webview/webview.h" | 19 #include "ui/views/controls/webview/webview.h" |
19 #include "ui/views/layout/fill_layout.h" | 20 #include "ui/views/layout/fill_layout.h" |
20 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
21 #include "ui/wm/core/shadow_types.h" | 22 #include "ui/wm/core/shadow_types.h" |
22 #include "ui/wm/core/window_animations.h" | 23 #include "ui/wm/core/window_animations.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 const int kPanelHeight = 35; | 27 const int kPanelHeight = 35; |
27 const char kChromeVoxPanelRelativeUrl[] = "/cvox2/background/panel.html"; | 28 const char kChromeVoxPanelRelativeUrl[] = "/cvox2/background/panel.html"; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 87 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
87 params.parent = ash::Shell::GetContainer( | 88 params.parent = ash::Shell::GetContainer( |
88 root_window, ash::kShellWindowId_SettingBubbleContainer); | 89 root_window, ash::kShellWindowId_SettingBubbleContainer); |
89 params.delegate = this; | 90 params.delegate = this; |
90 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 91 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
91 params.bounds = gfx::Rect(0, 0, root_window->bounds().width(), | 92 params.bounds = gfx::Rect(0, 0, root_window->bounds().width(), |
92 root_window->bounds().height()); | 93 root_window->bounds().height()); |
93 widget_->Init(params); | 94 widget_->Init(params); |
94 SetShadowType(widget_->GetNativeWindow(), wm::SHADOW_TYPE_RECTANGULAR); | 95 SetShadowType(widget_->GetNativeWindow(), wm::SHADOW_TYPE_RECTANGULAR); |
95 | 96 |
96 gfx::Screen::GetScreen()->AddObserver(this); | 97 display::Screen::GetScreen()->AddObserver(this); |
97 } | 98 } |
98 | 99 |
99 ChromeVoxPanel::~ChromeVoxPanel() { | 100 ChromeVoxPanel::~ChromeVoxPanel() { |
100 gfx::Screen::GetScreen()->RemoveObserver(this); | 101 display::Screen::GetScreen()->RemoveObserver(this); |
101 } | 102 } |
102 | 103 |
103 aura::Window* ChromeVoxPanel::GetRootWindow() { | 104 aura::Window* ChromeVoxPanel::GetRootWindow() { |
104 return GetWidget()->GetNativeWindow()->GetRootWindow(); | 105 return GetWidget()->GetNativeWindow()->GetRootWindow(); |
105 } | 106 } |
106 | 107 |
107 void ChromeVoxPanel::Close() { | 108 void ChromeVoxPanel::Close() { |
108 widget_->Close(); | 109 widget_->Close(); |
109 } | 110 } |
110 | 111 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 157 } |
157 | 158 |
158 void ChromeVoxPanel::DeleteDelegate() { | 159 void ChromeVoxPanel::DeleteDelegate() { |
159 delete this; | 160 delete this; |
160 } | 161 } |
161 | 162 |
162 views::View* ChromeVoxPanel::GetContentsView() { | 163 views::View* ChromeVoxPanel::GetContentsView() { |
163 return web_view_; | 164 return web_view_; |
164 } | 165 } |
165 | 166 |
166 void ChromeVoxPanel::OnDisplayMetricsChanged(const gfx::Display& display, | 167 void ChromeVoxPanel::OnDisplayMetricsChanged(const display::Display& display, |
167 uint32_t changed_metrics) { | 168 uint32_t changed_metrics) { |
168 UpdateWidgetBounds(); | 169 UpdateWidgetBounds(); |
169 } | 170 } |
170 | 171 |
171 void ChromeVoxPanel::UpdateWidgetBounds() { | 172 void ChromeVoxPanel::UpdateWidgetBounds() { |
172 gfx::Rect bounds(GetRootWindow()->bounds().size()); | 173 gfx::Rect bounds(GetRootWindow()->bounds().size()); |
173 if (!panel_fullscreen_) | 174 if (!panel_fullscreen_) |
174 bounds.set_height(kPanelHeight); | 175 bounds.set_height(kPanelHeight); |
175 | 176 |
176 // If we're in full-screen mode, give the panel a height of 0 unless | 177 // If we're in full-screen mode, give the panel a height of 0 unless |
177 // it's active. | 178 // it's active. |
178 if (ash::GetRootWindowController(GetRootWindow()) | 179 if (ash::GetRootWindowController(GetRootWindow()) |
179 ->GetWindowForFullscreenMode() && | 180 ->GetWindowForFullscreenMode() && |
180 !widget_->IsActive()) { | 181 !widget_->IsActive()) { |
181 bounds.set_height(0); | 182 bounds.set_height(0); |
182 } | 183 } |
183 | 184 |
184 widget_->SetBounds(bounds); | 185 widget_->SetBounds(bounds); |
185 } | 186 } |
OLD | NEW |