Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / browser_content_setting_bubble_model_delegate.cc
blob8736fa5f5c8fdc15429f4546e155418de20c3346
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
7 #include "chrome/browser/content_settings/chrome_content_settings_utils.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/chrome_pages.h"
11 #include "chrome/browser/ui/tab_dialogs.h"
12 #include "chrome/common/url_constants.h"
13 #include "components/google/core/browser/google_util.h"
15 // The URL for when the user clicks "learn more" on the mixed scripting page
16 // icon bubble.
17 const char kInsecureScriptHelpUrl[] =
18 "https://support.google.com/chrome/answer/1342714";
20 BrowserContentSettingBubbleModelDelegate::
21 BrowserContentSettingBubbleModelDelegate(Browser* browser) : browser_(browser) {
24 BrowserContentSettingBubbleModelDelegate::
25 ~BrowserContentSettingBubbleModelDelegate() {
28 void BrowserContentSettingBubbleModelDelegate::ShowCollectedCookiesDialog(
29 content::WebContents* web_contents) {
30 TabDialogs::FromWebContents(web_contents)->ShowCollectedCookies();
33 void BrowserContentSettingBubbleModelDelegate::ShowContentSettingsPage(
34 ContentSettingsType type) {
35 switch (type) {
36 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT:
37 // We don't (yet?) implement user-settable exceptions for mixed script
38 // blocking, so bounce to an explanatory page for now.
39 content_settings::RecordMixedScriptAction(
40 content_settings::MIXED_SCRIPT_ACTION_CLICKED_LEARN_MORE);
41 chrome::AddSelectedTabWithURL(browser_,
42 GURL(kInsecureScriptHelpUrl),
43 ui::PAGE_TRANSITION_LINK);
44 return;
45 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS:
46 chrome::ShowSettingsSubPage(browser_, chrome::kHandlerSettingsSubPage);
47 return;
48 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
49 // If the user requested to see the settings page for both camera
50 // and microphone, point them to the default settings instead of
51 // exceptions, as camera and microphone exceptions are now in two
52 // different overlays. Specifically, point them to the microphone
53 // default settings, as those appear first in the list.
54 chrome::ShowContentSettings(
55 browser_, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
56 return;
57 default:
58 chrome::ShowContentSettingsExceptions(browser_, type);
59 return;
63 void BrowserContentSettingBubbleModelDelegate::ShowLearnMorePage(
64 ContentSettingsType type) {
65 if (type != CONTENT_SETTINGS_TYPE_PLUGINS)
66 return;
67 chrome::AddSelectedTabWithURL(browser_,
68 GURL(chrome::kBlockedPluginLearnMoreURL),
69 ui::PAGE_TRANSITION_LINK);