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

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

Issue 1550983003: Give the ChromeVox Panel an extension view type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VIEW_TYPE_COMPONENT Created 4 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/ui/webui_login_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
11 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
11 #include "chrome/common/extensions/extension_constants.h" 12 #include "chrome/common/extensions/extension_constants.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "extensions/browser/view_type_utils.h"
13 #include "ui/chromeos/accessibility_types.h" 15 #include "ui/chromeos/accessibility_types.h"
14 #include "ui/views/controls/webview/webview.h" 16 #include "ui/views/controls/webview/webview.h"
15 #include "ui/views/layout/fill_layout.h" 17 #include "ui/views/layout/fill_layout.h"
16 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
17 #include "ui/wm/core/shadow_types.h" 19 #include "ui/wm/core/shadow_types.h"
18 #include "ui/wm/core/window_animations.h" 20 #include "ui/wm/core/window_animations.h"
19 21
20 namespace { 22 namespace {
21 23
22 const int kPanelHeight = 35; 24 const int kPanelHeight = 35;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DISALLOW_COPY_AND_ASSIGN(ChromeVoxPanelWebContentsObserver); 59 DISALLOW_COPY_AND_ASSIGN(ChromeVoxPanelWebContentsObserver);
58 }; 60 };
59 61
60 ChromeVoxPanel::ChromeVoxPanel(content::BrowserContext* browser_context) 62 ChromeVoxPanel::ChromeVoxPanel(content::BrowserContext* browser_context)
61 : widget_(nullptr), web_view_(nullptr), fullscreen_(false) { 63 : widget_(nullptr), web_view_(nullptr), fullscreen_(false) {
62 std::string url("chrome-extension://"); 64 std::string url("chrome-extension://");
63 url += extension_misc::kChromeVoxExtensionId; 65 url += extension_misc::kChromeVoxExtensionId;
64 url += kChromeVoxPanelRelativeUrl; 66 url += kChromeVoxPanelRelativeUrl;
65 67
66 views::WebView* web_view = new views::WebView(browser_context); 68 views::WebView* web_view = new views::WebView(browser_context);
69 content::WebContents* contents = web_view->GetWebContents();
67 web_contents_observer_.reset( 70 web_contents_observer_.reset(
68 new ChromeVoxPanelWebContentsObserver(web_view->GetWebContents(), this)); 71 new ChromeVoxPanelWebContentsObserver(contents, this));
72 extensions::SetViewType(contents, extensions::VIEW_TYPE_COMPONENT);
73 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
74 contents);
69 web_view->LoadInitialURL(GURL(url)); 75 web_view->LoadInitialURL(GURL(url));
70 web_view_ = web_view; 76 web_view_ = web_view;
71 77
72 widget_ = new views::Widget(); 78 widget_ = new views::Widget();
73 views::Widget::InitParams params( 79 views::Widget::InitParams params(
74 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 80 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
75 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); 81 aura::Window* root_window = ash::Shell::GetPrimaryRootWindow();
76 params.parent = ash::Shell::GetContainer( 82 params.parent = ash::Shell::GetContainer(
77 root_window, ash::kShellWindowId_SettingBubbleContainer); 83 root_window, ash::kShellWindowId_SettingBubbleContainer);
78 params.delegate = this; 84 params.delegate = this;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 uint32_t changed_metrics) { 144 uint32_t changed_metrics) {
139 UpdateWidgetBounds(); 145 UpdateWidgetBounds();
140 } 146 }
141 147
142 void ChromeVoxPanel::UpdateWidgetBounds() { 148 void ChromeVoxPanel::UpdateWidgetBounds() {
143 gfx::Rect bounds(GetRootWindow()->bounds().size()); 149 gfx::Rect bounds(GetRootWindow()->bounds().size());
144 if (!fullscreen_) 150 if (!fullscreen_)
145 bounds.set_height(kPanelHeight); 151 bounds.set_height(kPanelHeight);
146 widget_->SetBounds(bounds); 152 widget_->SetBounds(bounds);
147 } 153 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/ui/webui_login_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698