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

Side by Side Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 12039058: content: convert zoom notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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/profiles/off_the_record_profile_impl.h" 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" 38 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h"
39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
40 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
41 #include "chrome/common/chrome_paths.h" 41 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/extensions/extension.h" 43 #include "chrome/common/extensions/extension.h"
44 #include "chrome/common/pref_names.h" 44 #include "chrome/common/pref_names.h"
45 #include "chrome/common/render_messages.h" 45 #include "chrome/common/render_messages.h"
46 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
47 #include "content/public/browser/host_zoom_map.h" 47 #include "content/public/browser/host_zoom_map.h"
48 #include "content/public/browser/notification_service.h"
49 #include "content/public/browser/notification_types.h"
50 #include "content/public/browser/render_process_host.h" 48 #include "content/public/browser/render_process_host.h"
51 #include "content/public/browser/storage_partition.h" 49 #include "content/public/browser/storage_partition.h"
52 #include "content/public/browser/web_contents.h" 50 #include "content/public/browser/web_contents.h"
53 #include "net/base/transport_security_state.h" 51 #include "net/base/transport_security_state.h"
54 #include "net/http/http_server_properties.h" 52 #include "net/http/http_server_properties.h"
55 #include "webkit/database/database_tracker.h" 53 #include "webkit/database/database_tracker.h"
56 54
57 #if defined(OS_ANDROID) 55 #if defined(OS_ANDROID)
58 #include "chrome/browser/prefs/scoped_user_pref_update.h" 56 #include "chrome/browser/prefs/scoped_user_pref_update.h"
59 #endif 57 #endif
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 g_browser_process->io_thread()->ChangedToOnTheRecord(); 156 g_browser_process->io_thread()->ChangedToOnTheRecord();
159 } 157 }
160 158
161 void OffTheRecordProfileImpl::InitHostZoomMap() { 159 void OffTheRecordProfileImpl::InitHostZoomMap() {
162 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); 160 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
163 HostZoomMap* parent_host_zoom_map = 161 HostZoomMap* parent_host_zoom_map =
164 HostZoomMap::GetForBrowserContext(profile_); 162 HostZoomMap::GetForBrowserContext(profile_);
165 host_zoom_map->CopyFrom(parent_host_zoom_map); 163 host_zoom_map->CopyFrom(parent_host_zoom_map);
166 // Observe parent's HZM change for propagating change of parent's 164 // Observe parent's HZM change for propagating change of parent's
167 // change to this HZM. 165 // change to this HZM.
168 registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 166 Observe(parent_host_zoom_map);
169 content::Source<HostZoomMap>(parent_host_zoom_map));
170 } 167 }
171 168
172 #if defined(OS_ANDROID) 169 #if defined(OS_ANDROID)
173 void OffTheRecordProfileImpl::UseSystemProxy() { 170 void OffTheRecordProfileImpl::UseSystemProxy() {
174 // Force the use of the system-assigned proxy when off the record. 171 // Force the use of the system-assigned proxy when off the record.
175 const char kProxyMode[] = "mode"; 172 const char kProxyMode[] = "mode";
176 const char kProxyServer[] = "server"; 173 const char kProxyServer[] = "server";
177 const char kProxyBypassList[] = "bypass_list"; 174 const char kProxyBypassList[] = "bypass_list";
178 const char kProxyPacUrl[] = "pac_url"; 175 const char kProxyPacUrl[] = "pac_url";
179 DictionaryPrefUpdate update(prefs_, prefs::kProxy); 176 DictionaryPrefUpdate update(prefs_, prefs::kProxy);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // closed. We must do this asynchronously in order to avoid reentrancy issues. 418 // closed. We must do this asynchronously in order to avoid reentrancy issues.
422 if (!completion.is_null()) { 419 if (!completion.is_null()) {
423 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion); 420 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion);
424 } 421 }
425 } 422 }
426 423
427 GURL OffTheRecordProfileImpl::GetHomePage() { 424 GURL OffTheRecordProfileImpl::GetHomePage() {
428 return profile_->GetHomePage(); 425 return profile_->GetHomePage();
429 } 426 }
430 427
431 void OffTheRecordProfileImpl::Observe( 428 void OffTheRecordProfileImpl::OnZoomLevelChanged(const std::string& host) {
432 int type, 429 if (host.empty())
433 const content::NotificationSource& source, 430 return;
434 const content::NotificationDetails& details) { 431
435 if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { 432 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
436 const std::string& host = 433 HostZoomMap* parent_host_zoom_map =
437 *(content::Details<const std::string>(details).ptr()); 434 HostZoomMap::GetForBrowserContext(profile_);
438 if (!host.empty()) { 435 double level = parent_host_zoom_map->GetZoomLevel(host);
439 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this); 436 host_zoom_map->SetZoomLevel(host, level);
440 HostZoomMap* parent_host_zoom_map =
441 HostZoomMap::GetForBrowserContext(profile_);
442 double level = parent_host_zoom_map->GetZoomLevel(host);
443 host_zoom_map->SetZoomLevel(host, level);
444 }
445 }
446 } 437 }
447 438
448 #if defined(OS_CHROMEOS) 439 #if defined(OS_CHROMEOS)
449 // Special case of the OffTheRecordProfileImpl which is used while Guest 440 // Special case of the OffTheRecordProfileImpl which is used while Guest
450 // session in CrOS. 441 // session in CrOS.
451 class GuestSessionProfile : public OffTheRecordProfileImpl { 442 class GuestSessionProfile : public OffTheRecordProfileImpl {
452 public: 443 public:
453 explicit GuestSessionProfile(Profile* real_profile) 444 explicit GuestSessionProfile(Profile* real_profile)
454 : OffTheRecordProfileImpl(real_profile) { 445 : OffTheRecordProfileImpl(real_profile) {
455 } 446 }
(...skipping 18 matching lines...) Expand all
474 if (!profile) 465 if (!profile)
475 profile = new OffTheRecordProfileImpl(this); 466 profile = new OffTheRecordProfileImpl(this);
476 profile->Init(); 467 profile->Init();
477 return profile; 468 return profile;
478 } 469 }
479 470
480 base::Callback<ChromeURLDataManagerBackend*(void)> 471 base::Callback<ChromeURLDataManagerBackend*(void)>
481 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { 472 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const {
482 return io_data_.GetChromeURLDataManagerBackendGetter(); 473 return io_data_.GetChromeURLDataManagerBackendGetter();
483 } 474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698