OLD | NEW |
---|---|
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, and provides information |
bulach
2013/07/18 08:56:50
nit: perhaps "per tab for a given |ContentSettings
Takashi Toyoshima
2013/07/22 12:59:18
Done.
| |
21 // and presentation data about the geolocation usage. | 22 // and presentation data about a content setting usage. |
22 class GeolocationSettingsState { | 23 class ContentSettingsUsagesState { |
23 public: | 24 public: |
24 explicit GeolocationSettingsState(Profile* profile); | 25 ContentSettingsUsagesState(Profile* profile, ContentSettingsType type); |
25 virtual ~GeolocationSettingsState(); | 26 virtual ~ContentSettingsUsagesState(); |
26 | 27 |
27 typedef std::map<GURL, ContentSetting> StateMap; | 28 typedef std::map<GURL, ContentSetting> StateMap; |
28 const StateMap& state_map() const { | 29 const StateMap& state_map() const { |
29 return state_map_; | 30 return state_map_; |
30 } | 31 } |
31 | 32 |
32 // Sets the state for |requesting_origin|. | 33 // Sets the state for |requesting_origin|. |
33 void OnGeolocationPermissionSet(const GURL& requesting_origin, bool allowed); | 34 void OnPermissionSet(const GURL& requesting_origin, bool allowed); |
34 | 35 |
35 // Delegated by WebContents to indicate a navigation has happened and we | 36 // Delegated by WebContents to indicate a navigation has happened and we |
36 // may need to clear our settings. | 37 // may need to clear our settings. |
37 void DidNavigate(const content::LoadCommittedDetails& details); | 38 void DidNavigate(const content::LoadCommittedDetails& details); |
38 | 39 |
39 void ClearStateMap(); | 40 void ClearStateMap(); |
40 | 41 |
41 enum TabState { | 42 enum TabState { |
42 TABSTATE_NONE = 0, | 43 TABSTATE_NONE = 0, |
43 // There's at least one entry with non-default setting. | 44 // There's at least one entry with non-default setting. |
(...skipping 11 matching lines...) Expand all Loading... | |
55 FormattedHostsPerState; | 56 FormattedHostsPerState; |
56 | 57 |
57 // Returns an (optional) |formatted_hosts_per_state| and a mask of TabState. | 58 // Returns an (optional) |formatted_hosts_per_state| and a mask of TabState. |
58 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state, | 59 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state, |
59 unsigned int* tab_state_flags) const; | 60 unsigned int* tab_state_flags) const; |
60 | 61 |
61 private: | 62 private: |
62 std::string GURLToFormattedHost(const GURL& url) const; | 63 std::string GURLToFormattedHost(const GURL& url) const; |
63 | 64 |
64 Profile* profile_; | 65 Profile* profile_; |
66 ContentSettingsType type_; | |
65 StateMap state_map_; | 67 StateMap state_map_; |
66 GURL embedder_url_; | 68 GURL embedder_url_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(GeolocationSettingsState); | 70 DISALLOW_COPY_AND_ASSIGN(ContentSettingsUsagesState); |
69 }; | 71 }; |
70 | 72 |
71 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_ | 73 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_USAGES_STATE_H_ |
OLD | NEW |