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.
4
5#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
6
7#include "chrome/browser/google/google_util.h"
8#include "chrome/browser/ui/browser.h"
9#include "chrome/browser/ui/browser_dialogs.h"
10#include "chrome/browser/ui/browser_tabstrip.h"
11#include "chrome/browser/ui/chrome_pages.h"
12#include "chrome/common/url_constants.h"
13
14// The URL for when the user clicks "learn more" on the mixed scripting page
15// icon bubble.
16const char kInsecureScriptHelpUrl[] =
17    "https://support.google.com/chrome/bin/answer.py?answer=1342714";
18
19BrowserContentSettingBubbleModelDelegate::
20BrowserContentSettingBubbleModelDelegate(Browser* browser) : browser_(browser) {
21}
22
23BrowserContentSettingBubbleModelDelegate::
24~BrowserContentSettingBubbleModelDelegate() {
25}
26
27void BrowserContentSettingBubbleModelDelegate::ShowCollectedCookiesDialog(
28    content::WebContents* web_contents) {
29  chrome::ShowCollectedCookiesDialog(web_contents);
30}
31
32void BrowserContentSettingBubbleModelDelegate::ShowContentSettingsPage(
33    ContentSettingsType type) {
34  if (type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT) {
35    // We don't (yet?) implement user-settable exceptions for mixed script
36    // blocking, so bounce to an explanatory page for now.
37    GURL url(google_util::AppendGoogleLocaleParam(
38        GURL(kInsecureScriptHelpUrl)));
39    chrome::AddSelectedTabWithURL(browser_, url, content::PAGE_TRANSITION_LINK);
40    return;
41  }
42
43  if (type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
44    chrome::ShowSettingsSubPage(browser_, chrome::kHandlerSettingsSubPage);
45    return;
46  }
47
48  chrome::ShowContentSettings(browser_, type);
49}
50