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

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

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r288093. Created 6 years, 4 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/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 15 matching lines...) Expand all
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
27 #include "base/command_line.h" 27 #include "base/command_line.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "chromeos/chromeos_switches.h" 29 #include "chromeos/chromeos_switches.h"
30 #endif 30 #endif
31 31
32 #if defined(OS_ANDROID) && defined(FULL_SAFE_BROWSING) 32 #if defined(OS_ANDROID) && defined(FULL_SAFE_BROWSING)
33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 33 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
34 #endif 34 #endif
35 35
36 using content::HostZoomMap;
37
36 Profile::Profile() 38 Profile::Profile()
37 : restored_last_session_(false), 39 : restored_last_session_(false),
38 sent_destroyed_notification_(false), 40 sent_destroyed_notification_(false),
39 accessibility_pause_level_(0) { 41 accessibility_pause_level_(0) {
40 } 42 }
41 43
42 Profile::~Profile() { 44 Profile::~Profile() {
43 } 45 }
44 46
45 // static 47 // static
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 content::NotificationService::NoDetails()); 252 content::NotificationService::NoDetails());
251 } 253 }
252 } 254 }
253 255
254 bool ProfileCompare::operator()(Profile* a, Profile* b) const { 256 bool ProfileCompare::operator()(Profile* a, Profile* b) const {
255 DCHECK(a && b); 257 DCHECK(a && b);
256 if (a->IsSameProfile(b)) 258 if (a->IsSameProfile(b))
257 return false; 259 return false;
258 return a->GetOriginalProfile() < b->GetOriginalProfile(); 260 return a->GetOriginalProfile() < b->GetOriginalProfile();
259 } 261 }
262
263 void Profile::TrackZoomLevelsFromParent(Profile* parent) {
264 if (GetProfileType() != INCOGNITO_PROFILE ||
265 parent->GetProfileType() != REGULAR_PROFILE)
266 return;
267
268 // Here we only want to use zoom levels stored in the main-context's default
269 // storage partition. We're not interested in zoom levels in special
270 // partitions, e.g. those used by WebViewGuests.
awong 2014/08/11 22:36:33 Can we explain why? This is confusing to me...
wjmaclean 2014/08/12 16:57:44 The incognito profile, when created, basically tra
271 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
272 HostZoomMap* parent_host_zoom_map = HostZoomMap::GetForBrowserContext(parent);
273 host_zoom_map->CopyFrom(parent_host_zoom_map);
274 // Observe parenti profile's HostZoomMap changes so they can also be applied
275 // to this profile's HostZoomMap.
276 track_zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback(
277 base::Bind(&Profile::TrackZoomLevelChanged, base::Unretained(this)));
278 }
279
280 void Profile::TrackZoomLevelChanged(
281 const HostZoomMap::ZoomLevelChange& change) {
282 HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
283 switch (change.mode) {
284 case HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM:
285 return;
286 case HostZoomMap::ZOOM_CHANGED_FOR_HOST:
287 host_zoom_map->SetZoomLevelForHost(change.host, change.zoom_level);
288 return;
289 case HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST:
290 host_zoom_map->SetZoomLevelForHostAndScheme(change.scheme,
291 change.host,
292 change.zoom_level);
293 return;
294 }
295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698