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

Side by Side Diff: chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc

Issue 541103002: Introduce ChromeZoomLevelPref, make zoom level prefs independent of profile prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert to using only profile prefs. Created 6 years, 2 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 (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/ui/webui/constrained_web_dialog_delegate_base.h" 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/renderer_preferences_util.h" 10 #include "chrome/browser/renderer_preferences_util.h"
11 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" 11 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
12 #include "chrome/browser/ui/zoom/zoom_controller.h"
12 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/renderer_preferences.h"
14 #include "ipc/ipc_message.h" 16 #include "ipc/ipc_message.h"
15 #include "ui/web_dialogs/web_dialog_delegate.h" 17 #include "ui/web_dialogs/web_dialog_delegate.h"
16 #include "ui/web_dialogs/web_dialog_ui.h" 18 #include "ui/web_dialogs/web_dialog_ui.h"
17 19
18 using content::NativeWebKeyboardEvent; 20 using content::NativeWebKeyboardEvent;
19 using content::WebContents; 21 using content::WebContents;
20 using ui::WebDialogDelegate; 22 using ui::WebDialogDelegate;
21 using ui::WebDialogWebContentsDelegate; 23 using ui::WebDialogWebContentsDelegate;
22 24
23 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase( 25 ConstrainedWebDialogDelegateBase::ConstrainedWebDialogDelegateBase(
24 content::BrowserContext* browser_context, 26 content::BrowserContext* browser_context,
25 WebDialogDelegate* delegate, 27 WebDialogDelegate* delegate,
26 WebDialogWebContentsDelegate* tab_delegate) 28 WebDialogWebContentsDelegate* tab_delegate)
27 : WebDialogWebContentsDelegate(browser_context, 29 : WebDialogWebContentsDelegate(browser_context,
28 new ChromeWebContentsHandler), 30 new ChromeWebContentsHandler),
29 web_dialog_delegate_(delegate), 31 web_dialog_delegate_(delegate),
30 closed_via_webui_(false), 32 closed_via_webui_(false),
31 release_contents_on_close_(false) { 33 release_contents_on_close_(false) {
32 CHECK(delegate); 34 CHECK(delegate);
33 web_contents_.reset( 35 web_contents_.reset(
34 WebContents::Create(WebContents::CreateParams(browser_context))); 36 WebContents::Create(WebContents::CreateParams(browser_context)));
35 if (tab_delegate) { 37 if (tab_delegate) {
36 override_tab_delegate_.reset(tab_delegate); 38 override_tab_delegate_.reset(tab_delegate);
37 web_contents_->SetDelegate(tab_delegate); 39 web_contents_->SetDelegate(tab_delegate);
38 } else { 40 } else {
39 web_contents_->SetDelegate(this); 41 web_contents_->SetDelegate(this);
40 } 42 }
43 content::RendererPreferences* prefs =
44 web_contents_->GetMutableRendererPrefs();
41 renderer_preferences_util::UpdateFromSystemSettings( 45 renderer_preferences_util::UpdateFromSystemSettings(
42 web_contents_->GetMutableRendererPrefs(), 46 prefs, Profile::FromBrowserContext(browser_context));
43 Profile::FromBrowserContext(browser_context)); 47 prefs->default_zoom_level = ZoomController::FromWebContents(
48 web_contents_.get())->GetDefaultZoomLevel();
Bernhard Bauer 2014/10/01 15:09:14 Also indent just four spaces w/r/t the previous li
wjmaclean 2014/10/01 20:33:00 Done. The style-guide isn't terribly clear in this
49
44 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 50 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
45 51
46 // Set |this| as a delegate so the ConstrainedWebDialogUI can retrieve it. 52 // Set |this| as a delegate so the ConstrainedWebDialogUI can retrieve it.
47 ConstrainedWebDialogUI::SetConstrainedDelegate(web_contents_.get(), this); 53 ConstrainedWebDialogUI::SetConstrainedDelegate(web_contents_.get(), this);
48 54
49 web_contents_->GetController().LoadURL(delegate->GetDialogContentURL(), 55 web_contents_->GetController().LoadURL(delegate->GetDialogContentURL(),
50 content::Referrer(), 56 content::Referrer(),
51 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 57 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
52 std::string()); 58 std::string());
53 } 59 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 93 }
88 94
89 WebContents* ConstrainedWebDialogDelegateBase::GetWebContents() { 95 WebContents* ConstrainedWebDialogDelegateBase::GetWebContents() {
90 return web_contents_.get(); 96 return web_contents_.get();
91 } 97 }
92 98
93 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent( 99 void ConstrainedWebDialogDelegateBase::HandleKeyboardEvent(
94 content::WebContents* source, 100 content::WebContents* source,
95 const NativeWebKeyboardEvent& event) { 101 const NativeWebKeyboardEvent& event) {
96 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698