OLD | NEW |
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 CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Fields describing the current mic/camera state. If a page has attempted to | 48 // Fields describing the current mic/camera state. If a page has attempted to |
49 // access a device, the XXX_ACCESSED bit will be set. If access was blocked, | 49 // access a device, the XXX_ACCESSED bit will be set. If access was blocked, |
50 // XXX_BLOCKED will be set. | 50 // XXX_BLOCKED will be set. |
51 typedef uint32_t MicrophoneCameraState; | 51 typedef uint32_t MicrophoneCameraState; |
52 static const MicrophoneCameraState MICROPHONE_CAMERA_NOT_ACCESSED = 0; | 52 static const MicrophoneCameraState MICROPHONE_CAMERA_NOT_ACCESSED = 0; |
53 static const MicrophoneCameraState MICROPHONE_ACCESSED = 1 << 0; | 53 static const MicrophoneCameraState MICROPHONE_ACCESSED = 1 << 0; |
54 static const MicrophoneCameraState MICROPHONE_BLOCKED = 1 << 1; | 54 static const MicrophoneCameraState MICROPHONE_BLOCKED = 1 << 1; |
55 static const MicrophoneCameraState CAMERA_ACCESSED = 1 << 2; | 55 static const MicrophoneCameraState CAMERA_ACCESSED = 1 << 2; |
56 static const MicrophoneCameraState CAMERA_BLOCKED = 1 << 3; | 56 static const MicrophoneCameraState CAMERA_BLOCKED = 1 << 3; |
57 | 57 |
| 58 // UMA statistics for the mixed content shield |
| 59 enum MixedScriptAction { |
| 60 MIXED_SCRIPT_ACTION_DISPLAYED_SHIELD = 0, |
| 61 MIXED_SCRIPT_ACTION_DISPLAYED_BUBBLE, |
| 62 MIXED_SCRIPT_ACTION_CLICKED_ALLOW, |
| 63 MIXED_SCRIPT_ACTION_CLICKED_LEARN_MORE, |
| 64 MIXED_SCRIPT_ACTION_COUNT |
| 65 }; |
| 66 |
58 // Classes that want to be notified about site data events must implement | 67 // Classes that want to be notified about site data events must implement |
59 // this abstract class and add themselves as observer to the | 68 // this abstract class and add themselves as observer to the |
60 // |TabSpecificContentSettings|. | 69 // |TabSpecificContentSettings|. |
61 class SiteDataObserver { | 70 class SiteDataObserver { |
62 public: | 71 public: |
63 explicit SiteDataObserver( | 72 explicit SiteDataObserver( |
64 TabSpecificContentSettings* tab_specific_content_settings); | 73 TabSpecificContentSettings* tab_specific_content_settings); |
65 virtual ~SiteDataObserver(); | 74 virtual ~SiteDataObserver(); |
66 | 75 |
67 // Called whenever site data is accessed. | 76 // Called whenever site data is accessed. |
68 virtual void OnSiteDataAccessed() = 0; | 77 virtual void OnSiteDataAccessed() = 0; |
69 | 78 |
70 TabSpecificContentSettings* tab_specific_content_settings() { | 79 TabSpecificContentSettings* tab_specific_content_settings() { |
71 return tab_specific_content_settings_; | 80 return tab_specific_content_settings_; |
72 } | 81 } |
73 | 82 |
74 // Called when the TabSpecificContentSettings is destroyed; nulls out | 83 // Called when the TabSpecificContentSettings is destroyed; nulls out |
75 // the local reference. | 84 // the local reference. |
76 void ContentSettingsDestroyed(); | 85 void ContentSettingsDestroyed(); |
77 | 86 |
78 private: | 87 private: |
79 TabSpecificContentSettings* tab_specific_content_settings_; | 88 TabSpecificContentSettings* tab_specific_content_settings_; |
80 | 89 |
81 DISALLOW_COPY_AND_ASSIGN(SiteDataObserver); | 90 DISALLOW_COPY_AND_ASSIGN(SiteDataObserver); |
82 }; | 91 }; |
83 | 92 |
84 virtual ~TabSpecificContentSettings(); | 93 virtual ~TabSpecificContentSettings(); |
85 | 94 |
| 95 static void RecordMixedScriptAction(MixedScriptAction action); |
| 96 |
86 // Returns the object given a render view's id. | 97 // Returns the object given a render view's id. |
87 static TabSpecificContentSettings* Get(int render_process_id, | 98 static TabSpecificContentSettings* Get(int render_process_id, |
88 int render_view_id); | 99 int render_view_id); |
89 | 100 |
90 // Returns the object given a render frame's id. | 101 // Returns the object given a render frame's id. |
91 static TabSpecificContentSettings* GetForFrame(int render_process_id, | 102 static TabSpecificContentSettings* GetForFrame(int render_process_id, |
92 int render_view_id); | 103 int render_view_id); |
93 | 104 |
94 // Static methods called on the UI threads. | 105 // Static methods called on the UI threads. |
95 // Called when cookies for the given URL were read either from within the | 106 // Called when cookies for the given URL were read either from within the |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 std::string media_stream_requested_audio_device_; | 456 std::string media_stream_requested_audio_device_; |
446 std::string media_stream_requested_video_device_; | 457 std::string media_stream_requested_video_device_; |
447 | 458 |
448 // Observer to watch for content settings changed. | 459 // Observer to watch for content settings changed. |
449 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; | 460 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; |
450 | 461 |
451 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); | 462 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); |
452 }; | 463 }; |
453 | 464 |
454 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ | 465 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ |
OLD | NEW |