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_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
10 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h" | 10 #include "chrome/browser/chromeos/accessibility/chromevox_panel.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 web_view->LoadInitialURL(GURL(url)); | 75 web_view->LoadInitialURL(GURL(url)); |
76 web_view_ = web_view; | 76 web_view_ = web_view; |
77 | 77 |
78 widget_ = new views::Widget(); | 78 widget_ = new views::Widget(); |
79 views::Widget::InitParams params( | 79 views::Widget::InitParams params( |
80 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 80 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
81 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); | 81 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); |
82 params.parent = ash::Shell::GetContainer( | 82 params.parent = ash::Shell::GetContainer( |
83 root_window, ash::kShellWindowId_SettingBubbleContainer); | 83 root_window, ash::kShellWindowId_SettingBubbleContainer); |
84 params.delegate = this; | 84 params.delegate = this; |
85 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | |
86 params.bounds = gfx::Rect(0, 0, root_window->bounds().width(), | 85 params.bounds = gfx::Rect(0, 0, root_window->bounds().width(), |
87 root_window->bounds().height()); | 86 root_window->bounds().height()); |
88 widget_->Init(params); | 87 widget_->Init(params); |
89 SetShadowType(widget_->GetNativeWindow(), wm::SHADOW_TYPE_RECTANGULAR); | 88 SetShadowType(widget_->GetNativeWindow(), wm::SHADOW_TYPE_RECTANGULAR); |
90 | 89 |
91 ash::Shell::GetScreen()->AddObserver(this); | 90 ash::Shell::GetScreen()->AddObserver(this); |
92 } | 91 } |
93 | 92 |
94 ChromeVoxPanel::~ChromeVoxPanel() { | 93 ChromeVoxPanel::~ChromeVoxPanel() { |
95 ash::Shell::GetScreen()->RemoveObserver(this); | 94 ash::Shell::GetScreen()->RemoveObserver(this); |
96 } | 95 } |
97 | 96 |
98 aura::Window* ChromeVoxPanel::GetRootWindow() { | 97 aura::Window* ChromeVoxPanel::GetRootWindow() { |
99 return GetWidget()->GetNativeWindow()->GetRootWindow(); | 98 return GetWidget()->GetNativeWindow()->GetRootWindow(); |
100 } | 99 } |
101 | 100 |
102 void ChromeVoxPanel::Close() { | 101 void ChromeVoxPanel::Close() { |
103 widget_->Close(); | 102 widget_->Close(); |
104 } | 103 } |
105 | 104 |
106 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() { | 105 void ChromeVoxPanel::DidFirstVisuallyNonEmptyPaint() { |
107 widget_->Show(); | 106 widget_->Show(); |
108 ash::ShelfLayoutManager::ForShelf(GetRootWindow()) | 107 ash::ShelfLayoutManager::ForShelf(GetRootWindow()) |
109 ->SetChromeVoxPanelHeight(kPanelHeight); | 108 ->SetChromeVoxPanelHeight(kPanelHeight); |
110 } | 109 } |
111 | 110 |
112 void ChromeVoxPanel::EnterFullscreen() { | 111 void ChromeVoxPanel::EnterFullscreen() { |
113 fullscreen_ = true; | 112 fullscreen_ = true; |
| 113 widget_->Activate(); |
114 UpdateWidgetBounds(); | 114 UpdateWidgetBounds(); |
115 } | 115 } |
116 | 116 |
117 void ChromeVoxPanel::ExitFullscreen() { | 117 void ChromeVoxPanel::ExitFullscreen() { |
118 fullscreen_ = false; | 118 fullscreen_ = false; |
119 UpdateWidgetBounds(); | 119 UpdateWidgetBounds(); |
120 } | 120 } |
121 | 121 |
122 void ChromeVoxPanel::DisableSpokenFeedback() { | 122 void ChromeVoxPanel::DisableSpokenFeedback() { |
123 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( | 123 chromeos::AccessibilityManager::Get()->EnableSpokenFeedback( |
(...skipping 20 matching lines...) Expand all Loading... |
144 uint32_t changed_metrics) { | 144 uint32_t changed_metrics) { |
145 UpdateWidgetBounds(); | 145 UpdateWidgetBounds(); |
146 } | 146 } |
147 | 147 |
148 void ChromeVoxPanel::UpdateWidgetBounds() { | 148 void ChromeVoxPanel::UpdateWidgetBounds() { |
149 gfx::Rect bounds(GetRootWindow()->bounds().size()); | 149 gfx::Rect bounds(GetRootWindow()->bounds().size()); |
150 if (!fullscreen_) | 150 if (!fullscreen_) |
151 bounds.set_height(kPanelHeight); | 151 bounds.set_height(kPanelHeight); |
152 widget_->SetBounds(bounds); | 152 widget_->SetBounds(bounds); |
153 } | 153 } |
OLD | NEW |