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

Side by Side Diff: chrome/browser/geolocation/geolocation_settings_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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_
7
8 #include <map>
9 #include <set>
10
11 #include "chrome/common/content_settings.h"
12 #include "url/gurl.h"
13
14 class Profile;
15
16 namespace content {
17 struct LoadCommittedDetails;
18 }
19
20 // This class manages the geolocation state per tab, and provides information
21 // and presentation data about the geolocation usage.
22 class GeolocationSettingsState {
23 public:
24 explicit GeolocationSettingsState(Profile* profile);
25 virtual ~GeolocationSettingsState();
26
27 typedef std::map<GURL, ContentSetting> StateMap;
28 const StateMap& state_map() const {
29 return state_map_;
30 }
31
32 // Sets the state for |requesting_origin|.
33 void OnGeolocationPermissionSet(const GURL& requesting_origin, bool allowed);
34
35 // Delegated by WebContents to indicate a navigation has happened and we
36 // may need to clear our settings.
37 void DidNavigate(const content::LoadCommittedDetails& details);
38
39 void ClearStateMap();
40
41 enum TabState {
42 TABSTATE_NONE = 0,
43 // There's at least one entry with non-default setting.
44 TABSTATE_HAS_EXCEPTION = 1 << 1,
45 // There's at least one entry with a non-ASK setting.
46 TABSTATE_HAS_ANY_ICON = 1 << 2,
47 // There's at least one entry with ALLOWED setting.
48 TABSTATE_HAS_ANY_ALLOWED = 1 << 3,
49 // There's at least one entry that doesn't match the saved setting.
50 TABSTATE_HAS_CHANGED = 1 << 4,
51 };
52
53 // Maps ContentSetting to a set of hosts formatted for presentation.
54 typedef std::map<ContentSetting, std::set<std::string> >
55 FormattedHostsPerState;
56
57 // Returns an (optional) |formatted_hosts_per_state| and a mask of TabState.
58 void GetDetailedInfo(FormattedHostsPerState* formatted_hosts_per_state,
59 unsigned int* tab_state_flags) const;
60
61 private:
62 std::string GURLToFormattedHost(const GURL& url) const;
63
64 Profile* profile_;
65 StateMap state_map_;
66 GURL embedder_url_;
67
68 DISALLOW_COPY_AND_ASSIGN(GeolocationSettingsState);
69 };
70
71 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_SETTINGS_STATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_browsertest.cc ('k') | chrome/browser/geolocation/geolocation_settings_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698