OLD | NEW |
1 // Copyright 2013 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 COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STATE_H
_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STATE_H
_ |
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STATE_H
_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STATE_H
_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/content_settings/core/common/content_settings.h" | 12 #include "components/content_settings/core/common/content_settings.h" |
13 #include "components/content_settings/core/common/content_settings_types.h" | 13 #include "components/content_settings/core/common/content_settings_types.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 class HostContentSettingsMap; | 16 class HostContentSettingsMap; |
17 class PrefService; | |
18 | 17 |
19 // This class manages a content setting state per tab for a given | 18 // This class manages a content setting state per tab for a given |
20 // |ContentSettingsType|, and provides information and presentation data about | 19 // |ContentSettingsType|, and provides information and presentation data about |
21 // the content setting usage. | 20 // the content setting usage. |
22 class ContentSettingsUsagesState { | 21 class ContentSettingsUsagesState { |
23 public: | 22 public: |
24 // Information about navigation. | 23 // Information about navigation. |
25 struct CommittedDetails { | 24 struct CommittedDetails { |
26 CommittedDetails(); | 25 CommittedDetails(); |
27 ~CommittedDetails(); | 26 ~CommittedDetails(); |
28 | 27 |
29 bool current_url_valid; | 28 bool current_url_valid; |
30 GURL current_url; | 29 GURL current_url; |
31 GURL previous_url; | 30 GURL previous_url; |
32 }; | 31 }; |
33 | 32 |
34 ContentSettingsUsagesState( | 33 ContentSettingsUsagesState( |
35 HostContentSettingsMap* host_content_settings_map, | 34 HostContentSettingsMap* host_content_settings_map, |
36 ContentSettingsType type, | 35 ContentSettingsType type); |
37 const std::string& accept_language_pref, | |
38 PrefService* prefs); | |
39 ~ContentSettingsUsagesState(); | 36 ~ContentSettingsUsagesState(); |
40 | 37 |
41 typedef std::map<GURL, ContentSetting> StateMap; | 38 typedef std::map<GURL, ContentSetting> StateMap; |
42 const StateMap& state_map() const { | 39 const StateMap& state_map() const { |
43 return state_map_; | 40 return state_map_; |
44 } | 41 } |
45 | 42 |
46 // Sets the state for |requesting_origin|. | 43 // Sets the state for |requesting_origin|. |
47 void OnPermissionSet(const GURL& requesting_origin, bool allowed); | 44 void OnPermissionSet(const GURL& requesting_origin, bool allowed); |
48 | 45 |
(...skipping 19 matching lines...) Expand all Loading... |
68 typedef std::map<ContentSetting, std::set<std::string> > | 65 typedef std::map<ContentSetting, std::set<std::string> > |
69 FormattedHostsPerState; | 66 FormattedHostsPerState; |
70 | 67 |
71 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state, | 68 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state, |
72 unsigned int* tab_state_flags) const; | 69 unsigned int* tab_state_flags) const; |
73 | 70 |
74 private: | 71 private: |
75 std::string GURLToFormattedHost(const GURL& url) const; | 72 std::string GURLToFormattedHost(const GURL& url) const; |
76 | 73 |
77 HostContentSettingsMap* const host_content_settings_map_; | 74 HostContentSettingsMap* const host_content_settings_map_; |
78 PrefService* const pref_service_; | |
79 std::string accept_language_pref_; | |
80 ContentSettingsType type_; | 75 ContentSettingsType type_; |
81 StateMap state_map_; | 76 StateMap state_map_; |
82 GURL embedder_url_; | 77 GURL embedder_url_; |
83 | 78 |
84 DISALLOW_COPY_AND_ASSIGN(ContentSettingsUsagesState); | 79 DISALLOW_COPY_AND_ASSIGN(ContentSettingsUsagesState); |
85 }; | 80 }; |
86 | 81 |
87 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STAT
E_H_ | 82 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_USAGES_STAT
E_H_ |
OLD | NEW |