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

Side by Side Diff: chrome/browser/chromeos/login/webui_login_view.cc

Issue 10388166: Construct a TCW for the login view's WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login/webui_login_view.h" 5 #include "chrome/browser/chromeos/login/webui_login_view.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
15 #include "chrome/browser/chromeos/cros/cros_library.h" 15 #include "chrome/browser/chromeos/cros/cros_library.h"
16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" 16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
17 #include "chrome/browser/chromeos/login/webui_login_display.h" 17 #include "chrome/browser/chromeos/login/webui_login_display.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/renderer_preferences_util.h" 19 #include "chrome/browser/renderer_preferences_util.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" 21 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
21 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
22 #include "chrome/common/chrome_notification_types.h" 23 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
24 #include "chromeos/dbus/dbus_thread_manager.h" 25 #include "chromeos/dbus/dbus_thread_manager.h"
25 #include "chromeos/dbus/session_manager_client.h" 26 #include "chromeos/dbus/session_manager_client.h"
26 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/render_view_host_observer.h" 28 #include "content/public/browser/render_view_host_observer.h"
28 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_ui.h" 30 #include "content/public/browser/web_ui.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ash::SystemTray* tray = ash::Shell::GetInstance()->tray(); 155 ash::SystemTray* tray = ash::Shell::GetInstance()->tray();
155 if (tray) 156 if (tray)
156 tray->SetNextFocusableView(NULL); 157 tray->SetNextFocusableView(NULL);
157 } 158 }
158 159
159 void WebUILoginView::Init(views::Widget* login_window) { 160 void WebUILoginView::Init(views::Widget* login_window) {
160 login_window_ = login_window; 161 login_window_ = login_window;
161 webui_login_ = new views::WebView(ProfileManager::GetDefaultProfile()); 162 webui_login_ = new views::WebView(ProfileManager::GetDefaultProfile());
162 AddChildView(webui_login_); 163 AddChildView(webui_login_);
163 164
164 WebContents* web_contents = webui_login_->GetWebContents(); 165 // We create the WebContents ourselves because the TCW assumes ownership of
166 // it. This should be reworked once we don't need to use the TCW here.
167 WebContents* web_contents =
168 WebContents::Create(ProfileManager::GetDefaultProfile(),
169 NULL,
170 MSG_ROUTING_NONE,
171 NULL,
172 NULL);
173 wrapper_.reset(new TabContentsWrapper(web_contents));
174 webui_login_->SetWebContents(web_contents);
175
165 web_contents->SetDelegate(this); 176 web_contents->SetDelegate(this);
166 renderer_preferences_util::UpdateFromSystemSettings( 177 renderer_preferences_util::UpdateFromSystemSettings(
167 web_contents->GetMutableRendererPrefs(), 178 web_contents->GetMutableRendererPrefs(),
168 ProfileManager::GetDefaultProfile()); 179 ProfileManager::GetDefaultProfile());
169 180
170 tab_watcher_.reset(new TabRenderWatcher(web_contents, this)); 181 tab_watcher_.reset(new TabRenderWatcher(web_contents, this));
171 } 182 }
172 183
173 std::string WebUILoginView::GetClassName() const { 184 std::string WebUILoginView::GetClassName() const {
174 return kViewClassName; 185 return kViewClassName;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 return true; 342 return true;
332 } 343 }
333 344
334 void WebUILoginView::ReturnFocus(bool reverse) { 345 void WebUILoginView::ReturnFocus(bool reverse) {
335 // Return the focus to the web contents. 346 // Return the focus to the web contents.
336 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); 347 webui_login_->web_contents()->FocusThroughTabTraversal(reverse);
337 GetWidget()->Activate(); 348 GetWidget()->Activate();
338 } 349 }
339 350
340 } // namespace chromeos 351 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698