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

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

Issue 2048303002: Fix broken mixed script Rappor metric and add browser test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 4 years, 6 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
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 class HostContentSettingsMap; 30 class HostContentSettingsMap;
31 31
32 namespace content { 32 namespace content {
33 class RenderViewHost; 33 class RenderViewHost;
34 } 34 }
35 35
36 namespace net { 36 namespace net {
37 class CookieOptions; 37 class CookieOptions;
38 } 38 }
39 39
40 namespace rappor {
41 class RapporService;
42 }
43
40 // This class manages state about permissions, content settings, cookies and 44 // This class manages state about permissions, content settings, cookies and
41 // site data for a specific WebContents. It tracks which content was accessed 45 // site data for a specific WebContents. It tracks which content was accessed
42 // and which content was blocked. Based on this it provides information about 46 // and which content was blocked. Based on this it provides information about
43 // which types of content were accessed and blocked. 47 // which types of content were accessed and blocked.
44 class TabSpecificContentSettings 48 class TabSpecificContentSettings
45 : public content::WebContentsObserver, 49 : public content::WebContentsObserver,
46 public content_settings::Observer, 50 public content_settings::Observer,
47 public content::WebContentsUserData<TabSpecificContentSettings> { 51 public content::WebContentsUserData<TabSpecificContentSettings> {
48 public: 52 public:
49 // Fields describing the current mic/camera state. If a page has attempted to 53 // Fields describing the current mic/camera state. If a page has attempted to
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // Adds the given |SiteDataObserver|. The |observer| is notified when a 363 // Adds the given |SiteDataObserver|. The |observer| is notified when a
360 // locale shared object, like for example a cookie, is accessed. 364 // locale shared object, like for example a cookie, is accessed.
361 void AddSiteDataObserver(SiteDataObserver* observer); 365 void AddSiteDataObserver(SiteDataObserver* observer);
362 366
363 // Removes the given |SiteDataObserver|. 367 // Removes the given |SiteDataObserver|.
364 void RemoveSiteDataObserver(SiteDataObserver* observer); 368 void RemoveSiteDataObserver(SiteDataObserver* observer);
365 369
366 // Block all content. Used for testing content setting bubbles. 370 // Block all content. Used for testing content setting bubbles.
367 void BlockAllContentForTesting(); 371 void BlockAllContentForTesting();
368 372
373 // Set the Rappor service used for testing.
374 void SetRapporServiceForTesting(rappor::RapporService* rappor_service);
375
369 private: 376 private:
370 friend class content::WebContentsUserData<TabSpecificContentSettings>; 377 friend class content::WebContentsUserData<TabSpecificContentSettings>;
371 378
372 explicit TabSpecificContentSettings(content::WebContents* tab); 379 explicit TabSpecificContentSettings(content::WebContents* tab);
373 380
374 // content::WebContentsObserver overrides. 381 // content::WebContentsObserver overrides.
375 void RenderFrameForInterstitialPageCreated( 382 void RenderFrameForInterstitialPageCreated(
376 content::RenderFrameHost* render_frame_host) override; 383 content::RenderFrameHost* render_frame_host) override;
377 bool OnMessageReceived(const IPC::Message& message, 384 bool OnMessageReceived(const IPC::Message& message,
378 content::RenderFrameHost* render_frame_host) override; 385 content::RenderFrameHost* render_frame_host) override;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 std::string media_stream_selected_video_device_; 470 std::string media_stream_selected_video_device_;
464 471
465 // The devices to be displayed in the media bubble when the media stream 472 // The devices to be displayed in the media bubble when the media stream
466 // request is requesting certain specific devices. 473 // request is requesting certain specific devices.
467 std::string media_stream_requested_audio_device_; 474 std::string media_stream_requested_audio_device_;
468 std::string media_stream_requested_video_device_; 475 std::string media_stream_requested_video_device_;
469 476
470 // Observer to watch for content settings changed. 477 // Observer to watch for content settings changed.
471 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_; 478 ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
472 479
480 // The service used to record Rappor metrics. Can be set for testing.
481 rappor::RapporService* rappor_service_;
482
473 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings); 483 DISALLOW_COPY_AND_ASSIGN(TabSpecificContentSettings);
474 }; 484 };
475 485
476 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_ 486 #endif // CHROME_BROWSER_CONTENT_SETTINGS_TAB_SPECIFIC_CONTENT_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698