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

Side by Side Diff: chrome/browser/content_settings/content_settings_usages_state.h

Issue 19375002: Move GeolocationSettingsState to ContentSettingsUsagesState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review #9 Created 7 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_usages_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_ 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_USAGES_STATE_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_ 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_USAGES_STATE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "chrome/common/content_settings.h" 11 #include "chrome/common/content_settings.h"
12 #include "chrome/common/content_settings_types.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 class Profile; 15 class Profile;
15 16
16 namespace content { 17 namespace content {
17 struct LoadCommittedDetails; 18 struct LoadCommittedDetails;
18 } 19 }
19 20
20 // This class manages the geolocation state per tab, and provides information 21 // This class manages a content setting state per tab for a given
21 // and presentation data about the geolocation usage. 22 // |ContentSettingsType|, and provides information and presentation data about
22 class GeolocationSettingsState { 23 // the content setting usage.
24 class ContentSettingsUsagesState {
23 public: 25 public:
24 explicit GeolocationSettingsState(Profile* profile); 26 ContentSettingsUsagesState(Profile* profile, ContentSettingsType type);
25 virtual ~GeolocationSettingsState(); 27 virtual ~ContentSettingsUsagesState();
26 28
27 typedef std::map<GURL, ContentSetting> StateMap; 29 typedef std::map<GURL, ContentSetting> StateMap;
28 const StateMap& state_map() const { 30 const StateMap& state_map() const {
29 return state_map_; 31 return state_map_;
30 } 32 }
31 33
32 // Sets the state for |requesting_origin|. 34 // Sets the state for |requesting_origin|.
33 void OnGeolocationPermissionSet(const GURL& requesting_origin, bool allowed); 35 void OnPermissionSet(const GURL& requesting_origin, bool allowed);
34 36
35 // Delegated by WebContents to indicate a navigation has happened and we 37 // Delegated by WebContents to indicate a navigation has happened and we
36 // may need to clear our settings. 38 // may need to clear our settings.
37 void DidNavigate(const content::LoadCommittedDetails& details); 39 void DidNavigate(const content::LoadCommittedDetails& details);
38 40
39 void ClearStateMap(); 41 void ClearStateMap();
40 42
41 enum TabState { 43 enum TabState {
42 TABSTATE_NONE = 0, 44 TABSTATE_NONE = 0,
43 // There's at least one entry with non-default setting. 45 // There's at least one entry with non-default setting.
(...skipping 11 matching lines...) Expand all
55 FormattedHostsPerState; 57 FormattedHostsPerState;
56 58
57 // Returns an (optional) |formatted_hosts_per_state| and a mask of TabState. 59 // Returns an (optional) |formatted_hosts_per_state| and a mask of TabState.
58 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state, 60 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state,
59 unsigned int* tab_state_flags) const; 61 unsigned int* tab_state_flags) const;
60 62
61 private: 63 private:
62 std::string GURLToFormattedHost(const GURL& url) const; 64 std::string GURLToFormattedHost(const GURL& url) const;
63 65
64 Profile* profile_; 66 Profile* profile_;
67 ContentSettingsType type_;
65 StateMap state_map_; 68 StateMap state_map_;
66 GURL embedder_url_; 69 GURL embedder_url_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(GeolocationSettingsState); 71 DISALLOW_COPY_AND_ASSIGN(ContentSettingsUsagesState);
69 }; 72 };
70 73
71 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_ 74 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_USAGES_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_usages_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698