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

Side by Side Diff: content/public/browser/host_zoom_map.h

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Perhaps HostZoomLevelContextDeleter was needed after all ... Created 6 years, 1 month 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 #ifndef CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_
6 #define CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ 6 #define CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/callback_list.h" 14 #include "base/callback_list.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 class NavigationEntry; 20 class NavigationEntry;
21 class BrowserContext; 21 class BrowserContext;
22 class ResourceContext; 22 class ResourceContext;
23 class SiteInstance;
23 class WebContents; 24 class WebContents;
24 25
25 // Maps hostnames to custom zoom levels. Written on the UI thread and read on 26 // Maps hostnames to custom zoom levels. Written on the UI thread and read on
26 // any thread. One instance per browser context. Must be created on the UI 27 // any thread. One instance per browser context. Must be created on the UI
27 // thread, and it'll delete itself on the UI thread as well. 28 // thread, and it'll delete itself on the UI thread as well.
28 // Zoom can be defined at three levels: default zoom, zoom for host, and zoom 29 // Zoom can be defined at three levels: default zoom, zoom for host, and zoom
29 // for host with specific scheme. Setting any of the levels leaves settings 30 // for host with specific scheme. Setting any of the levels leaves settings
30 // for other settings intact. Getting the zoom level starts at the most 31 // for other settings intact. Getting the zoom level starts at the most
31 // specific setting and progresses to the less specific: first the zoom for the 32 // specific setting and progresses to the less specific: first the zoom for the
32 // host and scheme pair is checked, secondly the zoom for the host only and 33 // host and scheme pair is checked, secondly the zoom for the host only and
(...skipping 21 matching lines...) Expand all
54 55
55 typedef std::vector<ZoomLevelChange> ZoomLevelVector; 56 typedef std::vector<ZoomLevelChange> ZoomLevelVector;
56 57
57 // Extracts the URL from NavigationEntry, substituting the error page 58 // Extracts the URL from NavigationEntry, substituting the error page
58 // URL in the event that the error page is showing. 59 // URL in the event that the error page is showing.
59 CONTENT_EXPORT static GURL GetURLFromEntry(const NavigationEntry* entry); 60 CONTENT_EXPORT static GURL GetURLFromEntry(const NavigationEntry* entry);
60 61
61 CONTENT_EXPORT static HostZoomMap* GetDefaultForBrowserContext( 62 CONTENT_EXPORT static HostZoomMap* GetDefaultForBrowserContext(
62 BrowserContext* browser_context); 63 BrowserContext* browser_context);
63 64
65 // Returns the HostZoomMap associated with this SiteInstance. The SiteInstance
66 // may serve multiple WebContents, and the HostZoomMap is the same for all of
67 // these WebContents.
68 CONTENT_EXPORT static HostZoomMap* Get(SiteInstance* instance);
69
70 // Returns the HostZoomMap associated with this WebContents. If multiple
Charlie Reis 2014/11/04 23:43:17 These descriptions don't work out for out-of-proce
wjmaclean 2014/11/05 21:55:42 Done.
71 // WebContents share the same SiteInstance, then they share a single
72 // HostZoomMap.
73 CONTENT_EXPORT static HostZoomMap* GetForWebContents(
74 const WebContents* contents);
75
64 // Returns the current zoom level for the specified WebContents. May be 76 // Returns the current zoom level for the specified WebContents. May be
65 // temporary or host-specific. 77 // temporary or host-specific.
66 CONTENT_EXPORT static double GetZoomLevel(const WebContents* web_contents); 78 CONTENT_EXPORT static double GetZoomLevel(const WebContents* web_contents);
67 79
68 // Sets the current zoom level for the specified WebContents. The level may 80 // Sets the current zoom level for the specified WebContents. The level may
69 // be temporary or host-specific depending on the particular WebContents. 81 // be temporary or host-specific depending on the particular WebContents.
70 CONTENT_EXPORT static void SetZoomLevel(const WebContents* web_contents, 82 CONTENT_EXPORT static void SetZoomLevel(const WebContents* web_contents,
71 double level); 83 double level);
72 84
73 // Send an IPC to refresh any displayed error page's zoom levels. Needs to 85 // Send an IPC to refresh any displayed error page's zoom levels. Needs to
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( 162 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback(
151 const ZoomLevelChangedCallback& callback) = 0; 163 const ZoomLevelChangedCallback& callback) = 0;
152 164
153 protected: 165 protected:
154 virtual ~HostZoomMap() {} 166 virtual ~HostZoomMap() {}
155 }; 167 };
156 168
157 } // namespace content 169 } // namespace content
158 170
159 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ 171 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698