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

Side by Side Diff: content/browser/host_zoom_map_impl.h

Issue 287093002: Remove ViewMsg_SetZoomLevel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update temporary zoom settings in OnDocumentAvailableInMainFrame Created 6 years, 7 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_BROWSER_HOST_ZOOM_MAP_IMPL_H_ 5 #ifndef CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_
6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ 6 #define CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
23 // to notifications on there (and holds a NotificationRegistrar). 23 // to notifications on there (and holds a NotificationRegistrar).
24 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap), 24 class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
25 public NotificationObserver, 25 public NotificationObserver,
26 public base::SupportsUserData::Data { 26 public base::SupportsUserData::Data {
27 public: 27 public:
28 HostZoomMapImpl(); 28 HostZoomMapImpl();
29 virtual ~HostZoomMapImpl(); 29 virtual ~HostZoomMapImpl();
30 30
31 // HostZoomMap implementation: 31 // HostZoomMap implementation:
32 virtual void CopyFrom(HostZoomMap* copy) OVERRIDE; 32 virtual void CopyFrom(HostZoomMap* copy) OVERRIDE;
33 double GetZoomLevelForWebContents(
34 const WebContents& web_contents) const;
33 virtual double GetZoomLevelForHostAndScheme( 35 virtual double GetZoomLevelForHostAndScheme(
34 const std::string& scheme, 36 const std::string& scheme,
35 const std::string& host) const OVERRIDE; 37 const std::string& host) const OVERRIDE;
36 virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE; 38 virtual ZoomLevelVector GetAllZoomLevels() const OVERRIDE;
39 void SetZoomLevelForWebContents(const WebContents& web_contents,
40 double level);
41 void SetZoomLevelForView(int render_process_id,
42 int render_view_id,
43 double level,
44 const std::string& host);
jam 2014/05/23 15:51:04 here and above, don't put these methods which aren
wjmaclean 2014/05/23 17:07:09 Ooops, not paying attention here ... will move the
37 virtual void SetZoomLevelForHost( 45 virtual void SetZoomLevelForHost(
38 const std::string& host, 46 const std::string& host,
39 double level) OVERRIDE; 47 double level) OVERRIDE;
40 virtual void SetZoomLevelForHostAndScheme( 48 virtual void SetZoomLevelForHostAndScheme(
41 const std::string& scheme, 49 const std::string& scheme,
42 const std::string& host, 50 const std::string& host,
43 double level) OVERRIDE; 51 double level) OVERRIDE;
44 virtual double GetDefaultZoomLevel() const OVERRIDE; 52 virtual double GetDefaultZoomLevel() const OVERRIDE;
45 virtual void SetDefaultZoomLevel(double level) OVERRIDE; 53 virtual void SetDefaultZoomLevel(double level) OVERRIDE;
46 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback( 54 virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback(
47 const ZoomLevelChangedCallback& callback) OVERRIDE; 55 const ZoomLevelChangedCallback& callback) OVERRIDE;
48 56
57 bool UsesTemporaryZoomLevel(int render_process_id, int render_view_id) const;
58 void SetUsesTemporaryZoomLevel(int render_process_id,
59 int render_view_id,
60 bool uses_temporary_zoom_settings);
jam 2014/05/23 15:51:04 nit: document everything. also new line after this
wjmaclean 2014/05/23 17:07:09 Done.
49 // Returns the temporary zoom level that's only valid for the lifetime of 61 // Returns the temporary zoom level that's only valid for the lifetime of
50 // the given WebContents (i.e. isn't saved and doesn't affect other 62 // the given WebContents (i.e. isn't saved and doesn't affect other
51 // WebContentses) if it exists, the default zoom level otherwise. 63 // WebContentses) if it exists, the default zoom level otherwise.
52 // 64 //
53 // This may be called on any thread. 65 // This may be called on any thread.
54 double GetTemporaryZoomLevel(int render_process_id, 66 double GetTemporaryZoomLevel(int render_process_id,
55 int render_view_id) const; 67 int render_view_id) const;
56 68
57 // Sets the temporary zoom level that's only valid for the lifetime of this 69 // Sets the temporary zoom level that's only valid for the lifetime of this
58 // WebContents. 70 // WebContents.
(...skipping 20 matching lines...) Expand all
79 91
80 // Copy of the pref data, so that we can read it on the IO thread. 92 // Copy of the pref data, so that we can read it on the IO thread.
81 HostZoomLevels host_zoom_levels_; 93 HostZoomLevels host_zoom_levels_;
82 SchemeHostZoomLevels scheme_host_zoom_levels_; 94 SchemeHostZoomLevels scheme_host_zoom_levels_;
83 double default_zoom_level_; 95 double default_zoom_level_;
84 96
85 struct TemporaryZoomLevel { 97 struct TemporaryZoomLevel {
86 int render_process_id; 98 int render_process_id;
87 int render_view_id; 99 int render_view_id;
88 double zoom_level; 100 double zoom_level;
101
102 TemporaryZoomLevel(int process_id, int view_id, double level)
103 : render_process_id(process_id),
104 render_view_id(view_id),
105 zoom_level(level) {}
106
107 TemporaryZoomLevel(int process_id, int view_id)
108 : render_process_id(process_id),
109 render_view_id(view_id),
110 zoom_level(0.0) {}
111
112 bool operator==(const TemporaryZoomLevel& other) const {
113 return other.render_process_id == render_process_id &&
114 other.render_view_id == render_view_id;
115 }
89 }; 116 };
90 117
91 // Don't expect more than a couple of tabs that are using a temporary zoom 118 // Don't expect more than a couple of tabs that are using a temporary zoom
92 // level, so vector is fine for now. 119 // level, so vector is fine for now.
93 std::vector<TemporaryZoomLevel> temporary_zoom_levels_; 120 typedef std::vector<TemporaryZoomLevel> TemporaryZoomLevelList;
121 TemporaryZoomLevelList temporary_zoom_levels_;
94 122
95 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and 123 // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
96 // |temporary_zoom_levels_| to guarantee thread safety. 124 // |temporary_zoom_levels_| to guarantee thread safety.
97 mutable base::Lock lock_; 125 mutable base::Lock lock_;
98 126
99 NotificationRegistrar registrar_; 127 NotificationRegistrar registrar_;
100 128
101 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl); 129 DISALLOW_COPY_AND_ASSIGN(HostZoomMapImpl);
102 }; 130 };
103 131
104 } // namespace content 132 } // namespace content
105 133
106 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_ 134 #endif // CONTENT_BROWSER_HOST_ZOOM_MAP_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698