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

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

Issue 287093002: Remove ViewMsg_SetZoomLevel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised as per comments. Created 6 years, 6 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 #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 16
17 namespace content { 17 namespace content {
18 18
19 class BrowserContext; 19 class BrowserContext;
20 class ResourceContext; 20 class ResourceContext;
21 class WebContents;
21 22
22 // Maps hostnames to custom zoom levels. Written on the UI thread and read on 23 // Maps hostnames to custom zoom levels. Written on the UI thread and read on
23 // any thread. One instance per browser context. Must be created on the UI 24 // any thread. One instance per browser context. Must be created on the UI
24 // thread, and it'll delete itself on the UI thread as well. 25 // thread, and it'll delete itself on the UI thread as well.
25 // Zoom can be defined at three levels: default zoom, zoom for host, and zoom 26 // Zoom can be defined at three levels: default zoom, zoom for host, and zoom
26 // for host with specific scheme. Setting any of the levels leaves settings 27 // for host with specific scheme. Setting any of the levels leaves settings
27 // for other settings intact. Getting the zoom level starts at the most 28 // for other settings intact. Getting the zoom level starts at the most
28 // specific setting and progresses to the less specific: first the zoom for the 29 // specific setting and progresses to the less specific: first the zoom for the
29 // host and scheme pair is checked, secondly the zoom for the host only and 30 // host and scheme pair is checked, secondly the zoom for the host only and
30 // lastly default zoom. 31 // lastly default zoom.
(...skipping 16 matching lines...) Expand all
47 std::string host; 48 std::string host;
48 std::string scheme; 49 std::string scheme;
49 double zoom_level; 50 double zoom_level;
50 }; 51 };
51 52
52 typedef std::vector<ZoomLevelChange> ZoomLevelVector; 53 typedef std::vector<ZoomLevelChange> ZoomLevelVector;
53 54
54 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext( 55 CONTENT_EXPORT static HostZoomMap* GetForBrowserContext(
55 BrowserContext* browser_context); 56 BrowserContext* browser_context);
56 57
58 // Returns the current zoom level for the specified WebContents. May be
59 // temporary or host-specific.
60 CONTENT_EXPORT static double GetZoomLevel(const WebContents* web_contents);
61
62 // Sets the current zoom level for the specified WebContents. The level may
63 // be temporary or host-specific depending on the particular WebContents.
64 CONTENT_EXPORT static void SetZoomLevel(const WebContents* web_contents,
65 double level);
66
57 // Copy the zoom levels from the given map. Can only be called on the UI 67 // Copy the zoom levels from the given map. Can only be called on the UI
58 // thread. 68 // thread.
59 virtual void CopyFrom(HostZoomMap* copy) = 0; 69 virtual void CopyFrom(HostZoomMap* copy) = 0;
60 70
61 // Here |host| is the host portion of URL, or (in the absence of a host) 71 // Here |host| is the host portion of URL, or (in the absence of a host)
62 // the complete spec of the URL. 72 // the complete spec of the URL.
63 // Returns the zoom for the specified |scheme| and |host|. See class 73 // Returns the zoom for the specified |scheme| and |host|. See class
64 // description for details. 74 // description for details.
65 // 75 //
66 // This may be called on any thread. 76 // This may be called on any thread.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( 113 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback(
104 const ZoomLevelChangedCallback& callback) = 0; 114 const ZoomLevelChangedCallback& callback) = 0;
105 115
106 protected: 116 protected:
107 virtual ~HostZoomMap() {} 117 virtual ~HostZoomMap() {}
108 }; 118 };
109 119
110 } // namespace content 120 } // namespace content
111 121
112 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_ 122 #endif // CONTENT_PUBLIC_BROWSER_HOST_ZOOM_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698