summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 16:19:35 +0000
committermarkusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 16:19:35 +0000
commit2285262dd432869302d78e6eacfd595457512fde (patch)
tree0d0ec701d5eab2e803051d7df1bd16ac216ba89b
parentca6eaa5a5ce05232439f2a747da5bd73f672f13b (diff)
downloadchromium_src-2285262dd432869302d78e6eacfd595457512fde.zip
chromium_src-2285262dd432869302d78e6eacfd595457512fde.tar.gz
chromium_src-2285262dd432869302d78e6eacfd595457512fde.tar.bz2
In Chrome M23 the page info bubble was replaced by the website settings UI (aka website permissions UI/bubble). This CL removed the code of the old page info bubble and renames ShowPageInfo methods to ShowWebsiteSettings.
BUG=161987 Review URL: https://chromiumcodereview.appspot.com/11867019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178595 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/simple_web_view_dialog.cc9
-rw-r--r--chrome/browser/chromeos/login/simple_web_view_dialog.h8
-rw-r--r--chrome/browser/page_info_model.cc360
-rw-r--r--chrome/browser/page_info_model.h124
-rw-r--r--chrome/browser/page_info_model_observer.h17
-rw-r--r--chrome/browser/prefs/browser_prefs.cc1
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc10
-rw-r--r--chrome/browser/ui/browser_commands.cc11
-rw-r--r--chrome/browser/ui/browser_commands.h10
-rw-r--r--chrome/browser/ui/browser_window.h9
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.h4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm9
-rw-r--r--chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm4
-rw-r--r--chrome/browser/ui/cocoa/page_info_bubble_controller.h64
-rw-r--r--chrome/browser/ui/cocoa/page_info_bubble_controller.mm484
-rw-r--r--chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm211
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc13
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h4
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc4
-rw-r--r--chrome/browser/ui/gtk/page_info_bubble_gtk.cc260
-rw-r--r--chrome/browser/ui/page_info_bubble.h29
-rw-r--r--chrome/browser/ui/views/browser_dialogs.h8
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc8
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h4
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h10
-rw-r--r--chrome/browser/ui/views/location_bar/page_info_helper.cc2
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.cc478
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.h85
-rw-r--r--chrome/browser/ui/views/script_bubble_view.h2
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc10
-rw-r--r--chrome/browser/ui/views/toolbar_view.h8
-rw-r--r--chrome/chrome_browser.gypi3
-rw-r--r--chrome/chrome_browser_ui.gypi6
-rw-r--r--chrome/chrome_tests_unit.gypi1
-rw-r--r--chrome/test/base/test_browser_window.h4
35 files changed, 46 insertions, 2228 deletions
diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.cc b/chrome/browser/chromeos/login/simple_web_view_dialog.cc
index b1d817d..ce6d4c4 100644
--- a/chrome/browser/chromeos/login/simple_web_view_dialog.cc
+++ b/chrome/browser/chromeos/login/simple_web_view_dialog.cc
@@ -289,10 +289,11 @@ SimpleWebViewDialog::GetContentSettingBubbleModelDelegate() {
return bubble_model_delegate_.get();
}
-void SimpleWebViewDialog::ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) {
+void SimpleWebViewDialog::ShowWebsiteSettings(
+ content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history) {
NOTIMPLEMENTED();
// TODO (ygorshenin@,markusheintz@): implement this
}
diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.h b/chrome/browser/chromeos/login/simple_web_view_dialog.h
index 1298eba..6fb47a7 100644
--- a/chrome/browser/chromeos/login/simple_web_view_dialog.h
+++ b/chrome/browser/chromeos/login/simple_web_view_dialog.h
@@ -79,10 +79,10 @@ class SimpleWebViewDialog : public views::ButtonListener,
ExtensionAction* action) OVERRIDE;
virtual ContentSettingBubbleModelDelegate*
GetContentSettingBubbleModelDelegate() OVERRIDE;
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE;
+ virtual void ShowWebsiteSettings(content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history) OVERRIDE;
virtual void OnInputInProgress(bool in_progress) OVERRIDE;
// Implements ToolbarModelDelegate:
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc
deleted file mode 100644
index 5adadc5..0000000
--- a/chrome/browser/page_info_model.cc
+++ /dev/null
@@ -1,360 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/page_info_model.h"
-
-#include <string>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/command_line.h"
-#include "base/i18n/time_formatting.h"
-#include "base/string16.h"
-#include "base/string_number_conversions.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/history/history_service_factory.h"
-#include "chrome/browser/page_info_model_observer.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ssl/ssl_error_info.h"
-#include "content/public/browser/cert_store.h"
-#include "content/public/common/ssl_status.h"
-#include "content/public/common/url_constants.h"
-#include "grit/chromium_strings.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "net/base/cert_status_flags.h"
-#include "net/base/ssl_cipher_suite_names.h"
-#include "net/base/ssl_connection_status_flags.h"
-#include "net/base/x509_certificate.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-
-using content::SSLStatus;
-
-PageInfoModel::PageInfoModel(Profile* profile,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- PageInfoModelObserver* observer)
- : observer_(observer) {
- Init();
-
- if (url.SchemeIs(chrome::kChromeUIScheme)) {
- sections_.push_back(
- SectionInfo(ICON_STATE_INTERNAL_PAGE,
- string16(),
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE),
- SECTION_INFO_INTERNAL_PAGE));
- return;
- }
-
- SectionStateIcon icon_id = ICON_STATE_OK;
- string16 headline;
- string16 description;
- scoped_refptr<net::X509Certificate> cert;
-
- // Identity section.
- string16 subject_name(UTF8ToUTF16(url.host()));
- bool empty_subject_name = false;
- if (subject_name.empty()) {
- subject_name.assign(
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
- empty_subject_name = true;
- }
-
- if (ssl.cert_id &&
- content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) &&
- (!net::IsCertStatusError(ssl.cert_status) ||
- net::IsCertStatusMinorError(ssl.cert_status))) {
- // There are no major errors. Check for minor errors.
- if (net::IsCertStatusMinorError(ssl.cert_status)) {
- string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName()));
- if (issuer_name.empty()) {
- issuer_name.assign(l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
- }
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name));
-
- description += ASCIIToUTF16("\n\n");
- if (ssl.cert_status & net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) {
- description += l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_UNABLE_TO_CHECK_REVOCATION);
- } else if (ssl.cert_status & net::CERT_STATUS_NO_REVOCATION_MECHANISM) {
- description += l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NO_REVOCATION_MECHANISM);
- } else {
- NOTREACHED() << "Need to specify string for this warning";
- }
- icon_id = ICON_STATE_WARNING_MINOR;
- } else if (ssl.cert_status & net::CERT_STATUS_IS_EV) {
- // EV HTTPS page.
- DCHECK(!cert->subject().organization_names.empty());
- headline =
- l10n_util::GetStringFUTF16(IDS_PAGE_INFO_EV_IDENTITY_TITLE,
- UTF8ToUTF16(cert->subject().organization_names[0]),
- UTF8ToUTF16(url.host()));
- // An EV Cert is required to have a city (localityName) and country but
- // state is "if any".
- DCHECK(!cert->subject().locality_name.empty());
- DCHECK(!cert->subject().country_name.empty());
- string16 locality;
- if (!cert->subject().state_or_province_name.empty()) {
- locality = l10n_util::GetStringFUTF16(
- IDS_PAGEINFO_ADDRESS,
- UTF8ToUTF16(cert->subject().locality_name),
- UTF8ToUTF16(cert->subject().state_or_province_name),
- UTF8ToUTF16(cert->subject().country_name));
- } else {
- locality = l10n_util::GetStringFUTF16(
- IDS_PAGEINFO_PARTIAL_ADDRESS,
- UTF8ToUTF16(cert->subject().locality_name),
- UTF8ToUTF16(cert->subject().country_name));
- }
- DCHECK(!cert->subject().organization_names.empty());
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV,
- UTF8ToUTF16(cert->subject().organization_names[0]),
- locality,
- UTF8ToUTF16(cert->issuer().GetDisplayName())));
- } else {
- // Non-EV OK HTTPS page.
- if (empty_subject_name)
- headline.clear(); // Don't display any title.
- else
- headline.assign(subject_name);
- string16 issuer_name(UTF8ToUTF16(cert->issuer().GetDisplayName()));
- if (issuer_name.empty()) {
- issuer_name.assign(l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY));
- }
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, issuer_name));
- }
- } else {
- // HTTP or HTTPS with errors (not warnings).
- description.assign(l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY));
- icon_id = ssl.security_style == content::SECURITY_STYLE_UNAUTHENTICATED ?
- ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR;
-
- const string16 bullet = UTF8ToUTF16("\n • ");
- std::vector<SSLErrorInfo> errors;
- SSLErrorInfo::GetErrorsForCertStatus(ssl.cert_id, ssl.cert_status,
- url, &errors);
- for (size_t i = 0; i < errors.size(); ++i) {
- description += bullet;
- description += errors[i].short_description();
- }
-
- if (ssl.cert_status & net::CERT_STATUS_NON_UNIQUE_NAME) {
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NON_UNIQUE_NAME);
- }
- }
- sections_.push_back(SectionInfo(
- icon_id,
- headline,
- description,
- SECTION_INFO_IDENTITY));
-
- // Connection section.
- // We consider anything less than 80 bits encryption to be weak encryption.
- // TODO(wtc): Bug 1198735: report mixed/unsafe content for unencrypted and
- // weakly encrypted connections.
- icon_id = ICON_STATE_OK;
- headline.clear();
- description.clear();
- if (!ssl.cert_id) {
- // Not HTTPS.
- DCHECK_EQ(ssl.security_style, content::SECURITY_STYLE_UNAUTHENTICATED);
- icon_id = ssl.security_style == content::SECURITY_STYLE_UNAUTHENTICATED ?
- ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR;
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
- subject_name));
- } else if (ssl.security_bits < 0) {
- // Security strength is unknown. Say nothing.
- icon_id = ICON_STATE_ERROR;
- } else if (ssl.security_bits == 0) {
- DCHECK_NE(ssl.security_style, content::SECURITY_STYLE_UNAUTHENTICATED);
- icon_id = ICON_STATE_ERROR;
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
- subject_name));
- } else if (ssl.security_bits < 80) {
- icon_id = ICON_STATE_ERROR;
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
- subject_name));
- } else {
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
- subject_name,
- base::IntToString16(ssl.security_bits)));
- if (ssl.content_status) {
- bool ran_insecure_content =
- !!(ssl.content_status & SSLStatus::RAN_INSECURE_CONTENT);
- icon_id = ran_insecure_content ?
- ICON_STATE_ERROR : ICON_STATE_WARNING_MINOR;
- description.assign(l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
- description,
- l10n_util::GetStringUTF16(ran_insecure_content ?
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR :
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)));
- }
- }
-
- uint16 cipher_suite =
- net::SSLConnectionStatusToCipherSuite(ssl.connection_status);
- if (ssl.security_bits > 0 && cipher_suite) {
- int ssl_version =
- net::SSLConnectionStatusToVersion(ssl.connection_status);
- const char* ssl_version_str;
- net::SSLVersionToString(&ssl_version_str, ssl_version);
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SSL_VERSION,
- ASCIIToUTF16(ssl_version_str));
-
- bool did_fallback = (ssl.connection_status &
- net::SSL_CONNECTION_VERSION_FALLBACK) != 0;
- bool no_renegotiation =
- (ssl.connection_status &
- net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION) != 0;
- const char *key_exchange, *cipher, *mac;
- net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, cipher_suite);
-
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS,
- ASCIIToUTF16(cipher), ASCIIToUTF16(mac), ASCIIToUTF16(key_exchange));
-
- uint8 compression_id =
- net::SSLConnectionStatusToCompression(ssl.connection_status);
- if (compression_id) {
- const char* compression;
- net::SSLCompressionToString(&compression, compression_id);
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_COMPRESSION_DETAILS,
- ASCIIToUTF16(compression));
- }
-
- if (did_fallback) {
- // For now, only SSL/TLS version fallback will trigger a warning icon.
- if (icon_id < ICON_STATE_WARNING_MINOR)
- icon_id = ICON_STATE_WARNING_MINOR;
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_FALLBACK_MESSAGE);
- }
- if (no_renegotiation) {
- description += ASCIIToUTF16("\n\n");
- description += l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_RENEGOTIATION_MESSAGE);
- }
- }
-
- if (!description.empty()) {
- sections_.push_back(SectionInfo(
- icon_id,
- headline,
- description,
- SECTION_INFO_CONNECTION));
- }
-
- // Request the number of visits.
- HistoryService* history = HistoryServiceFactory::GetForProfile(
- profile, Profile::EXPLICIT_ACCESS);
- if (show_history && history) {
- history->GetVisibleVisitCountToHost(
- url,
- &request_consumer_,
- base::Bind(&PageInfoModel::OnGotVisitCountToHost,
- base::Unretained(this)));
- }
-
- if (ssl.cert_id) {
- certificate_label_ = l10n_util::GetStringUTF16(
- IDS_PAGEINFO_CERT_INFO_BUTTON);
- }
-}
-
-PageInfoModel::~PageInfoModel() {}
-
-int PageInfoModel::GetSectionCount() {
- return sections_.size();
-}
-
-PageInfoModel::SectionInfo PageInfoModel::GetSectionInfo(int index) {
- DCHECK(index < static_cast<int>(sections_.size()));
- return sections_[index];
-}
-
-gfx::Image* PageInfoModel::GetIconImage(SectionStateIcon icon_id) {
- if (icon_id == ICON_NONE)
- return NULL;
- // The bubble uses new, various icons.
- return icons_[icon_id];
-}
-
-void PageInfoModel::OnGotVisitCountToHost(HistoryService::Handle handle,
- bool found_visits,
- int count,
- base::Time first_visit) {
- if (!found_visits) {
- // This indicates an error, such as the page wasn't http/https; do nothing.
- return;
- }
-
- bool visited_before_today = false;
- if (count) {
- base::Time today = base::Time::Now().LocalMidnight();
- base::Time first_visit_midnight = first_visit.LocalMidnight();
- visited_before_today = (first_visit_midnight < today);
- }
-
- string16 headline = l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE);
-
- if (!visited_before_today) {
- sections_.push_back(SectionInfo(
- ICON_STATE_WARNING_MAJOR,
- headline,
- l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY),
- SECTION_INFO_FIRST_VISIT));
- } else {
- sections_.push_back(SectionInfo(
- ICON_STATE_INFO,
- headline,
- l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
- base::TimeFormatShortDate(first_visit)),
- SECTION_INFO_FIRST_VISIT));
- }
- observer_->OnPageInfoModelChanged();
-}
-
-string16 PageInfoModel::GetCertificateLabel() const {
- return certificate_label_;
-}
-
-PageInfoModel::PageInfoModel() : observer_(NULL) {
- Init();
-}
-
-void PageInfoModel::Init() {
- // Loads the icons into the vector. The order must match the SectionStateIcon
- // enum.
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_GOOD));
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MINOR));
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_WARNING_MAJOR));
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_BAD));
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PAGEINFO_INFO));
- icons_.push_back(&rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_26));
-}
diff --git a/chrome/browser/page_info_model.h b/chrome/browser/page_info_model.h
deleted file mode 100644
index 1c933ce..0000000
--- a/chrome/browser/page_info_model.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_PAGE_INFO_MODEL_H_
-#define CHROME_BROWSER_PAGE_INFO_MODEL_H_
-
-#include <vector>
-
-#include "base/string16.h"
-#include "chrome/browser/common/cancelable_request.h"
-#include "chrome/browser/history/history.h"
-#include "googleurl/src/gurl.h"
-#include "ui/gfx/image/image.h"
-
-class PageInfoModelObserver;
-class Profile;
-
-namespace content {
-struct SSLStatus;
-}
-
-// The model that provides the information that should be displayed in the page
-// info dialog/bubble.
-class PageInfoModel {
- public:
- enum SectionInfoType {
- SECTION_INFO_IDENTITY = 0,
- SECTION_INFO_CONNECTION,
- SECTION_INFO_FIRST_VISIT,
- SECTION_INFO_INTERNAL_PAGE, // Used for chrome:// pages, etc.
- };
-
- // NOTE: ICON_STATE_OK ... ICON_STATE_ERROR must be listed in increasing
- // order of severity. Code may depend on this order.
- enum SectionStateIcon {
- // No icon.
- ICON_NONE = -1,
- // State is OK.
- ICON_STATE_OK,
- // For example, if state is OK but contains mixed content.
- ICON_STATE_WARNING_MINOR,
- // For example, if content was served over HTTP.
- ICON_STATE_WARNING_MAJOR,
- // For example, unverified identity over HTTPS.
- ICON_STATE_ERROR,
- // An information icon.
- ICON_STATE_INFO,
- // Icon for internal pages.
- ICON_STATE_INTERNAL_PAGE,
- };
-
- struct SectionInfo {
- SectionInfo(SectionStateIcon icon_id,
- const string16& headline,
- const string16& description,
- SectionInfoType type)
- : icon_id(icon_id),
- headline(headline),
- description(description),
- type(type) {
- }
-
- // The overall state of the connection (error, warning, ok).
- SectionStateIcon icon_id;
-
- // A single line describing the section, optional.
- string16 headline;
-
- // The full description of what this section is.
- string16 description;
-
- // The type of SectionInfo we are dealing with, for example: Identity,
- // Connection, First Visit.
- SectionInfoType type;
- };
-
- PageInfoModel(Profile* profile,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history,
- PageInfoModelObserver* observer);
- ~PageInfoModel();
-
- int GetSectionCount();
- SectionInfo GetSectionInfo(int index);
-
- // Returns the native image type for an icon with the given id.
- gfx::Image* GetIconImage(SectionStateIcon icon_id);
-
- // Callback from history service with number of visits to url.
- void OnGotVisitCountToHost(HistoryService::Handle handle,
- bool found_visits,
- int count,
- base::Time first_visit);
-
- // Returns the label for the "Certificate Information", if needed.
- string16 GetCertificateLabel() const;
-
- protected:
- // Testing constructor. DO NOT USE.
- PageInfoModel();
-
- // Shared initialization for default and testing constructor.
- void Init();
-
- PageInfoModelObserver* observer_;
-
- std::vector<SectionInfo> sections_;
-
- // All possible icons that go next to the text descriptions to indicate state.
- std::vector<gfx::Image*> icons_;
-
- // Used to request number of visits.
- CancelableRequestConsumer request_consumer_;
-
- // Label for "Certificate Information", if needed.
- string16 certificate_label_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PageInfoModel);
-};
-
-#endif // CHROME_BROWSER_PAGE_INFO_MODEL_H_
diff --git a/chrome/browser/page_info_model_observer.h b/chrome/browser/page_info_model_observer.h
deleted file mode 100644
index 08abd95..0000000
--- a/chrome/browser/page_info_model_observer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_PAGE_INFO_MODEL_OBSERVER_H_
-#define CHROME_BROWSER_PAGE_INFO_MODEL_OBSERVER_H_
-
-// This interface should be implemented by classes interested in getting
-// notifications from PageInfoModel.
-class PageInfoModelObserver {
- public:
- virtual ~PageInfoModelObserver() {}
-
- virtual void OnPageInfoModelChanged() = 0;
-};
-
-#endif // CHROME_BROWSER_PAGE_INFO_MODEL_OBSERVER_H_
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 3aae243..594f853 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -41,7 +41,6 @@
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/notification_prefs_manager.h"
-#include "chrome/browser/page_info_model.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/pepper_flash_settings_manager.h"
#include "chrome/browser/plugins/plugin_finder.h"
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 440b7e5..9a4fbd3 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -1584,8 +1584,9 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
NavigationEntry* nav_entry = controller->GetActiveEntry();
Browser* browser =
chrome::FindBrowserWithWebContents(source_web_contents_);
- chrome::ShowPageInfo(browser, source_web_contents_, nav_entry->GetURL(),
- nav_entry->GetSSL(), true);
+ chrome::ShowWebsiteSettings(browser, source_web_contents_,
+ nav_entry->GetURL(), nav_entry->GetSSL(),
+ true);
break;
}
@@ -1625,8 +1626,9 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
case IDC_CONTENT_CONTEXT_VIEWFRAMEINFO: {
Browser* browser = chrome::FindBrowserWithWebContents(
source_web_contents_);
- chrome::ShowPageInfo(browser, source_web_contents_, params_.frame_url,
- params_.security_info, false);
+ chrome::ShowWebsiteSettings(browser, source_web_contents_,
+ params_.frame_url, params_.security_info,
+ false);
break;
}
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index bc5c64a..282597d 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -695,12 +695,11 @@ void ShowFindBar(Browser* browser) {
browser->GetFindBarController()->Show();
}
-// TODO(markusheintz): Rename the method to something more appropriate.
-void ShowPageInfo(Browser* browser,
- content::WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history) {
+void ShowWebsiteSettings(Browser* browser,
+ content::WebContents* web_contents,
+ const GURL& url,
+ const SSLStatus& ssl,
+ bool show_history) {
Profile* profile = Profile::FromBrowserContext(
web_contents->GetBrowserContext());
diff --git a/chrome/browser/ui/browser_commands.h b/chrome/browser/ui/browser_commands.h
index 0a3ae18..41a7f91 100644
--- a/chrome/browser/ui/browser_commands.h
+++ b/chrome/browser/ui/browser_commands.h
@@ -100,11 +100,11 @@ void TogglePagePinnedToStartScreen(Browser* browser);
void SavePage(Browser* browser);
bool CanSavePage(const Browser* browser);
void ShowFindBar(Browser* browser);
-void ShowPageInfo(Browser* browser,
- content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history);
+void ShowWebsiteSettings(Browser* browser,
+ content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history);
void ShowChromeToMobileBubble(Browser* browser);
void Print(Browser* browser);
bool CanPrint(const Browser* browser);
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index aaea72b..ad1184f 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -255,15 +255,6 @@ class BrowserWindow : public BaseWindow {
// on the page).
virtual void WebContentsFocused(content::WebContents* contents) = 0;
- // Shows the page info using the specified information.
- // |url| is the url of the page/frame the info applies to, |ssl| is the SSL
- // information for that page/frame. If |show_history| is true, a section
- // showing how many times that URL has been visited is added to the page info.
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) = 0;
-
// Shows the website settings using the specified information. |url| is the
// url of the page/frame the info applies to, |ssl| is the SSL information for
// that page/frame. If |show_history| is true, a section showing how many
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h
index 285ed46..f667251 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h
@@ -108,10 +108,6 @@ class BrowserWindowCocoa :
virtual void UserChangedTheme() OVERRIDE;
virtual int GetExtraRenderViewHeight() const OVERRIDE;
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE;
virtual void ShowWebsiteSettings(Profile* profile,
content::WebContents* web_contents,
const GURL& url,
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index dc62e7d..0b45d03 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -42,7 +42,6 @@
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#import "chrome/browser/ui/cocoa/web_dialog_window_controller.h"
#import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h"
-#include "chrome/browser/ui/page_info_bubble.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/web_applications/web_app.h"
@@ -518,14 +517,6 @@ void BrowserWindowCocoa::WebContentsFocused(WebContents* contents) {
NOTIMPLEMENTED();
}
-void BrowserWindowCocoa::ShowPageInfo(WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history) {
- chrome::ShowPageInfoBubble(window(), web_contents, url, ssl, show_history,
- browser_);
-}
-
void BrowserWindowCocoa::ShowWebsiteSettings(
Profile* profile,
content::WebContents* web_contents,
diff --git a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
index 522728e..3e607bf 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_icon_decoration.mm
@@ -104,8 +104,8 @@ bool LocationIconDecoration::OnMousePressed(NSRect frame) {
return true;
}
Browser* browser = chrome::FindBrowserWithWebContents(tab);
- chrome::ShowPageInfo(browser, tab, nav_entry->GetURL(), nav_entry->GetSSL(),
- true);
+ chrome::ShowWebsiteSettings(browser, tab, nav_entry->GetURL(),
+ nav_entry->GetSSL(), true);
return true;
}
diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.h b/chrome/browser/ui/cocoa/page_info_bubble_controller.h
deleted file mode 100644
index a82da66..0000000
--- a/chrome/browser/ui/cocoa/page_info_bubble_controller.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/memory/scoped_nsobject.h"
-#include "base/memory/scoped_ptr.h"
-#import "chrome/browser/ui/cocoa/base_bubble_controller.h"
-
-class PageInfoModel;
-class PageInfoModelObserver;
-
-namespace content {
-class PageNavigator;
-class WebContents;
-}
-
-// This NSWindowController subclass manages the InfoBubbleWindow and view that
-// are displayed when the user clicks the security lock icon.
-@interface PageInfoBubbleController : BaseBubbleController {
- @private
- // The model that generates the content displayed by the controller.
- scoped_ptr<PageInfoModel> model_;
-
- // Thin bridge that pushes model-changed notifications from C++ to Cocoa.
- scoped_ptr<PageInfoModelObserver> bridge_;
-
- // The certificate ID for the page, 0 if the page is not over HTTPS.
- int certID_;
-
- // The WebContents that created the bubble.
- content::WebContents* webContents_;
-
- // Used for loading pages.
- content::PageNavigator* navigator_;
-}
-
-@property(nonatomic, assign) int certID;
-
-// Designated initializer. The new instance will take ownership of |model| and
-// |bridge|. There should be a 1:1 mapping of models to bridges. The
-// controller will release itself when the bubble is closed. |parentWindow|
-// cannot be nil.
-- (id)initWithPageInfoModel:(PageInfoModel*)model
- modelObserver:(PageInfoModelObserver*)bridge
- parentWindow:(NSWindow*)parentWindow
- webContents:(content::WebContents*)webContents
- navigator:(content::PageNavigator*)navigator;
-
-
-// Shows the certificate display window. Note that this will implicitly close
-// the bubble because the certificate window will become key. The certificate
-// information attaches itself as a sheet to the |parentWindow|.
-- (IBAction)showCertWindow:(id)sender;
-
-// Opens the help center link that explains the contents of the page info.
-- (IBAction)showHelpPage:(id)sender;
-
-@end
-
-@interface PageInfoBubbleController (ExposedForUnitTesting)
-- (void)performLayout;
-@end
diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller.mm
deleted file mode 100644
index e41680d..0000000
--- a/chrome/browser/ui/cocoa/page_info_bubble_controller.mm
+++ /dev/null
@@ -1,484 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/page_info_bubble_controller.h"
-
-#include "base/bind.h"
-#include "base/compiler_specific.h"
-#include "base/memory/weak_ptr.h"
-#include "base/message_loop.h"
-#include "base/sys_string_conversions.h"
-#include "chrome/browser/certificate_viewer.h"
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/page_info_model_observer.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
-#import "chrome/browser/ui/cocoa/browser_window_controller.h"
-#import "chrome/browser/ui/cocoa/flipped_view.h"
-#import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
-#import "chrome/browser/ui/cocoa/info_bubble_view.h"
-#import "chrome/browser/ui/cocoa/info_bubble_window.h"
-#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/cert_store.h"
-#include "content/public/browser/page_navigator.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/ssl_status.h"
-#include "grit/generated_resources.h"
-#include "grit/locale_settings.h"
-#include "net/base/cert_status_flags.h"
-#include "net/base/x509_certificate.h"
-#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/l10n/l10n_util_mac.h"
-#include "ui/gfx/image/image.h"
-
-using content::OpenURLParams;
-using content::Referrer;
-using content::SSLStatus;
-using content::WebContents;
-
-@interface PageInfoBubbleController (Private)
-- (PageInfoModel*)model;
-- (NSButton*)certificateButtonWithFrame:(NSRect)frame;
-- (void)configureTextFieldAsLabel:(NSTextField*)textField;
-- (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atPoint:(NSPoint)point;
-- (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atPoint:(NSPoint)point;
-- (CGFloat)addCertificateButtonToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset;
-- (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset;
-- (CGFloat)addHelpButtonToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset;
-- (CGFloat)addSeparatorToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset;
-- (NSPoint)anchorPointForWindowWithHeight:(CGFloat)bubbleHeight
- parentWindow:(NSWindow*)parent;
-@end
-
-namespace {
-
-// The width of the window, in view coordinates. The height will be determined
-// by the content.
-const CGFloat kWindowWidth = 380;
-
-// Spacing in between sections.
-const CGFloat kVerticalSpacing = 10;
-
-// Padding along on the X-axis between the window frame and content.
-const CGFloat kFramePadding = 10;
-
-// Spacing between the optional headline and description text views.
-const CGFloat kHeadlineSpacing = 2;
-
-// Spacing between the image and the text.
-const CGFloat kImageSpacing = 10;
-
-// Square size of the image.
-const CGFloat kImageSize = 30;
-
-// The X position of the text fields. Variants for with and without an image.
-const CGFloat kTextXPositionNoImage = kFramePadding;
-const CGFloat kTextXPosition = kTextXPositionNoImage + kImageSize +
- kImageSpacing;
-
-// Width of the text fields.
-const CGFloat kTextWidth = kWindowWidth - (kImageSize + kImageSpacing +
- kFramePadding * 2);
-
-// Bridge that listens for change notifications from the model.
-class PageInfoModelBubbleBridge : public PageInfoModelObserver {
- public:
- PageInfoModelBubbleBridge()
- : controller_(nil),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
- }
-
- // PageInfoModelObserver implementation.
- virtual void OnPageInfoModelChanged() OVERRIDE {
- // Check to see if a layout has already been scheduled.
- if (weak_ptr_factory_.HasWeakPtrs())
- return;
-
- // Delay performing layout by a second so that all the animations from
- // InfoBubbleWindow and origin updates from BaseBubbleController finish, so
- // that we don't all race trying to change the frame's origin.
- //
- // Using MessageLoop is superior here to |-performSelector:| because it will
- // not retain its target; if the child outlives its parent, zombies get left
- // behind (http://crbug.com/59619). This will cancel the scheduled task if
- // the controller (and thus this bridge) get destroyed before the message
- // can be delivered.
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- base::Bind(&PageInfoModelBubbleBridge::PerformLayout,
- weak_ptr_factory_.GetWeakPtr()),
- base::TimeDelta::FromSeconds(1));
- }
-
- // Sets the controller.
- void set_controller(PageInfoBubbleController* controller) {
- controller_ = controller;
- }
-
- private:
- void PerformLayout() {
- // If the window is animating closed when this is called, the
- // animation could be holding the last reference to |controller_|
- // (and thus |this|). Pin it until the task is completed.
- scoped_nsobject<PageInfoBubbleController> keep_alive([controller_ retain]);
- [controller_ performLayout];
- }
-
- PageInfoBubbleController* controller_; // weak
-
- base::WeakPtrFactory<PageInfoModelBubbleBridge> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PageInfoModelBubbleBridge);
-};
-
-} // namespace
-
-namespace chrome {
-
-void ShowPageInfoBubble(gfx::NativeWindow parent,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator) {
- PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge();
- PageInfoModel* model = new PageInfoModel(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()), url, ssl,
- show_history, bridge);
- PageInfoBubbleController* controller =
- [[PageInfoBubbleController alloc] initWithPageInfoModel:model
- modelObserver:bridge
- parentWindow:parent
- webContents:web_contents
- navigator:navigator];
- bridge->set_controller(controller);
- [controller setCertID:ssl.cert_id];
- [controller showWindow:nil];
-}
-
-} // namespace chrome
-
-@implementation PageInfoBubbleController
-
-@synthesize certID = certID_;
-
-- (id)initWithPageInfoModel:(PageInfoModel*)model
- modelObserver:(PageInfoModelObserver*)bridge
- parentWindow:(NSWindow*)parentWindow
- webContents:(WebContents*)webContents
- navigator:(content::PageNavigator*)navigator {
- DCHECK(parentWindow);
-
- // Use an arbitrary height because it will be changed by the bridge.
- NSRect contentRect = NSMakeRect(0, 0, kWindowWidth, 1);
- // Create an empty window into which content is placed.
- scoped_nsobject<InfoBubbleWindow> window(
- [[InfoBubbleWindow alloc] initWithContentRect:contentRect
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:NO]);
-
- if ((self = [super initWithWindow:window.get()
- parentWindow:parentWindow
- anchoredAt:NSZeroPoint])) {
- model_.reset(model);
- bridge_.reset(bridge);
- webContents_ = webContents;
- navigator_ = navigator;
- [[self bubble] setArrowLocation:info_bubble::kTopLeft];
- [self performLayout];
- }
- return self;
-}
-
-- (PageInfoModel*)model {
- return model_.get();
-}
-
-- (IBAction)showCertWindow:(id)sender {
- DCHECK(certID_ != 0);
- ShowCertificateViewerByID(webContents_, [self parentWindow], certID_);
-}
-
-- (IBAction)showHelpPage:(id)sender {
- navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
- Referrer(),
- NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK,
- false));
-}
-
-// This will create the subviews for the page info window. The general layout
-// is 2 or 3 boxed and titled sections, each of which has a status image to
-// provide visual feedback and a description that explains it. The description
-// text is usually only 1 or 2 lines, but can be much longer. At the bottom of
-// the window is a button to view the SSL certificate, which is disabled if
-// not using HTTPS.
-- (void)performLayout {
- // |offset| is the Y position that should be drawn at next.
- CGFloat offset = kFramePadding + info_bubble::kBubbleArrowHeight;
-
- // Keep the new subviews in an array that gets replaced at the end.
- NSMutableArray* subviews = [NSMutableArray array];
-
- // Whether to include the help button at the bottom of the page info bubble.
- const int sectionCount = model_->GetSectionCount();
- BOOL showHelpButton = !(sectionCount == 1 && model_->GetSectionInfo(0).type ==
- PageInfoModel::SECTION_INFO_INTERNAL_PAGE);
-
- // The subviews will be attached to the FlippedView, which has a
- // flipped origin. This allows the code to build top-to-bottom.
- for (int i = 0; i < sectionCount; ++i) {
- PageInfoModel::SectionInfo info = model_->GetSectionInfo(i);
-
- // Only certain sections have images. This affects the X position.
- BOOL hasImage = model_->GetIconImage(info.icon_id) != nil;
- CGFloat xPosition = (hasImage ? kTextXPosition : kTextXPositionNoImage);
-
- // Insert the image subview for sections that are appropriate.
- CGFloat imageBaseline = offset + kImageSize;
- if (hasImage) {
- [self addImageViewForInfo:info toSubviews:subviews atOffset:offset];
- }
-
- // Add the title.
- if (!info.headline.empty()) {
- offset += [self addHeadlineViewForInfo:info
- toSubviews:subviews
- atPoint:NSMakePoint(xPosition, offset)];
- offset += kHeadlineSpacing;
- }
-
- // Create the description of the state.
- offset += [self addDescriptionViewForInfo:info
- toSubviews:subviews
- atPoint:NSMakePoint(xPosition, offset)];
-
- if (info.type == PageInfoModel::SECTION_INFO_IDENTITY && certID_) {
- offset += kVerticalSpacing;
- offset += [self addCertificateButtonToSubviews:subviews atOffset:offset];
- }
-
- // If at this point the description and optional headline and button are
- // not as tall as the image, adjust the offset by the difference.
- CGFloat imageBaselineDelta = imageBaseline - offset;
- if (imageBaselineDelta > 0)
- offset += imageBaselineDelta;
-
- // Add the separators.
- int testSectionCount = sectionCount - 1;
- if (i != testSectionCount || (i == testSectionCount && showHelpButton)) {
- offset += kVerticalSpacing;
- offset += [self addSeparatorToSubviews:subviews atOffset:offset];
- }
- }
-
- // The last item at the bottom of the window is the help center link. Do not
- // show this for the internal pages, which have one section.
- if (showHelpButton)
- offset += [self addHelpButtonToSubviews:subviews atOffset:offset];
-
- // Add the bottom padding.
- offset += kVerticalSpacing;
-
- // Create the dummy view that uses flipped coordinates.
- NSRect contentFrame = NSMakeRect(0, 0, kWindowWidth, offset);
- scoped_nsobject<FlippedView> contentView(
- [[FlippedView alloc] initWithFrame:contentFrame]);
- [contentView setSubviews:subviews];
- [contentView setAutoresizingMask:NSViewMinYMargin];
-
- NSRect windowFrame = NSMakeRect(0, 0, kWindowWidth, offset);
- windowFrame.size = [[[self window] contentView] convertSize:windowFrame.size
- toView:nil];
- // Adjust the origin by the difference in height.
- windowFrame.origin = [[self window] frame].origin;
- windowFrame.origin.y -= NSHeight(windowFrame) -
- NSHeight([[self window] frame]);
-
- // Resize the window. Only animate if the window is visible, otherwise it
- // could be "growing" while it's opening, looking awkward.
- [[self window] setFrame:windowFrame
- display:YES
- animate:[[self window] isVisible]];
-
- // Replace the window's content.
- [[[self window] contentView] setSubviews:
- [NSArray arrayWithObject:contentView]];
-
- NSPoint anchorPoint =
- [self anchorPointForWindowWithHeight:NSHeight(windowFrame)
- parentWindow:[self parentWindow]];
- [self setAnchorPoint:anchorPoint];
-}
-
-// Creates the button with a given |frame| that, when clicked, will show the
-// SSL certificate information.
-- (NSButton*)certificateButtonWithFrame:(NSRect)frame {
- NSButton* certButton = [[[NSButton alloc] initWithFrame:frame] autorelease];
- [certButton setTitle:
- l10n_util::GetNSStringWithFixup(IDS_PAGEINFO_CERT_INFO_BUTTON)];
- [certButton setButtonType:NSMomentaryPushInButton];
- [certButton setBezelStyle:NSRoundRectBezelStyle];
- [certButton setTarget:self];
- [certButton setAction:@selector(showCertWindow:)];
- [[certButton cell] setControlSize:NSSmallControlSize];
- NSFont* font = [NSFont systemFontOfSize:
- [NSFont systemFontSizeForControlSize:NSSmallControlSize]];
- [[certButton cell] setFont:font];
- return certButton;
-}
-
-// Sets proprties on the given |field| to act as the title or description labels
-// in the bubble.
-- (void)configureTextFieldAsLabel:(NSTextField*)textField {
- [textField setEditable:NO];
- [textField setSelectable:YES];
- [textField setDrawsBackground:NO];
- [textField setBezeled:NO];
-}
-
-// Adds the title text field at the given x,y position, and returns the y
-// position for the next element.
-- (CGFloat)addHeadlineViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atPoint:(NSPoint)point {
- NSRect frame = NSMakeRect(point.x, point.y, kTextWidth, kImageSpacing);
- scoped_nsobject<NSTextField> textField(
- [[NSTextField alloc] initWithFrame:frame]);
- [self configureTextFieldAsLabel:textField.get()];
- [textField setStringValue:base::SysUTF16ToNSString(info.headline)];
- NSFont* font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]];
- [textField setFont:font];
- frame.size.height +=
- [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:
- textField];
- [textField setFrame:frame];
- [subviews addObject:textField.get()];
- return NSHeight(frame);
-}
-
-// Adds the description text field at the given x,y position, and returns the y
-// position for the next element.
-- (CGFloat)addDescriptionViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atPoint:(NSPoint)point {
- NSRect frame = NSMakeRect(point.x, point.y, kTextWidth, kImageSize);
- scoped_nsobject<NSTextField> textField(
- [[NSTextField alloc] initWithFrame:frame]);
- [self configureTextFieldAsLabel:textField.get()];
- [textField setStringValue:base::SysUTF16ToNSString(info.description)];
- [textField setFont:[NSFont labelFontOfSize:[NSFont smallSystemFontSize]]];
-
- // If the text is oversized, resize the text field.
- frame.size.height +=
- [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:
- textField];
- [subviews addObject:textField.get()];
- return NSHeight(frame);
-}
-
-// Adds the certificate button at a pre-determined x position and the given y.
-// Returns the y position for the next element.
-- (CGFloat)addCertificateButtonToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset {
- // The certificate button should only be added if there is SSL information.
- DCHECK(certID_);
-
- // Create the certificate button. The frame will be fixed up by GTM, so
- // use arbitrary values.
- NSRect frame = NSMakeRect(kTextXPosition, offset, 100, 14);
- NSButton* certButton = [self certificateButtonWithFrame:frame];
- [subviews addObject:certButton];
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:certButton];
-
- // By default, assume that we don't have certificate information to show.
- scoped_refptr<net::X509Certificate> cert;
- content::CertStore::GetInstance()->RetrieveCert(certID_, &cert);
-
- // Don't bother showing certificates if there isn't one.
- if (!cert.get() || !cert->os_cert_handle()) {
- // This should only ever happen in unit tests.
- [certButton setEnabled:NO];
- }
-
- return NSHeight([certButton frame]);
-}
-
-// Adds the state image at a pre-determined x position and the given y. This
-// does not affect the next Y position because the image is placed next to
-// a text field that is larger and accounts for the image's size.
-- (void)addImageViewForInfo:(const PageInfoModel::SectionInfo&)info
- toSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset {
- NSRect frame =
- NSMakeRect(kFramePadding, offset, kImageSize, kImageSize);
- scoped_nsobject<NSImageView> imageView(
- [[NSImageView alloc] initWithFrame:frame]);
- [imageView setImageFrameStyle:NSImageFrameNone];
- [imageView setImage:model_->GetIconImage(info.icon_id)->ToNSImage()];
- [subviews addObject:imageView.get()];
-}
-
-// Adds the help center button that explains the icons. Returns the y position
-// delta for the next offset.
-- (CGFloat)addHelpButtonToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset {
- NSRect frame = NSMakeRect(kFramePadding, offset, 100, 10);
- scoped_nsobject<NSButton> button([[NSButton alloc] initWithFrame:frame]);
- NSString* string =
- l10n_util::GetNSStringWithFixup(IDS_PAGE_INFO_HELP_CENTER_LINK);
- scoped_nsobject<HyperlinkButtonCell> cell(
- [[HyperlinkButtonCell alloc] initTextCell:string]);
- [cell setControlSize:NSSmallControlSize];
- [button setCell:cell.get()];
- [button setButtonType:NSMomentaryPushInButton];
- [button setBezelStyle:NSRegularSquareBezelStyle];
- [button setTarget:self];
- [button setAction:@selector(showHelpPage:)];
- [subviews addObject:button.get()];
-
- // Call size-to-fit to fixup for the localized string.
- [GTMUILocalizerAndLayoutTweaker sizeToFitView:button.get()];
- return NSHeight([button frame]);
-}
-
-// Adds a 1px separator between sections. Returns the y position delta for the
-// next offset.
-- (CGFloat)addSeparatorToSubviews:(NSMutableArray*)subviews
- atOffset:(CGFloat)offset {
- NSBox* spacer = [self separatorWithFrame:NSMakeRect(kFramePadding, offset,
- kWindowWidth - 2 * kFramePadding, 0)];
- [subviews addObject:spacer];
- return kVerticalSpacing + NSHeight([spacer frame]);
-}
-
-// Takes in the bubble's height and the parent window, which should be a
-// BrowserWindow, and gets the proper anchor point for the bubble. The returned
-// point is in screen coordinates.
-- (NSPoint)anchorPointForWindowWithHeight:(CGFloat)bubbleHeight
- parentWindow:(NSWindow*)parent {
- BrowserWindowController* controller = [parent windowController];
- NSPoint origin = NSZeroPoint;
- if ([controller isKindOfClass:[BrowserWindowController class]]) {
- LocationBarViewMac* locationBar = [controller locationBarBridge];
- if (locationBar) {
- NSPoint bubblePoint = locationBar->GetPageInfoBubblePoint();
- origin = [parent convertBaseToScreen:bubblePoint];
- }
- }
- return origin;
-}
-
-@end
diff --git a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm
deleted file mode 100644
index 8c583b0..0000000
--- a/chrome/browser/ui/cocoa/page_info_bubble_controller_unittest.mm
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_nsobject.h"
-#include "base/string_number_conversions.h"
-#include "base/string_util.h"
-#include "base/sys_string_conversions.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/page_info_model_observer.h"
-#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
-#import "chrome/browser/ui/cocoa/page_info_bubble_controller.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-namespace {
-
-class FakeModel : public PageInfoModel {
- public:
- FakeModel() : PageInfoModel() {}
-
- void AddSection(SectionStateIcon icon_id,
- const string16& headline,
- const string16& description,
- SectionInfoType type) {
- sections_.push_back(SectionInfo(
- icon_id, headline, description, type));
- }
-};
-
-class FakeBridge : public PageInfoModelObserver {
- public:
- virtual void OnPageInfoModelChanged() OVERRIDE {}
-};
-
-class PageInfoBubbleControllerTest : public CocoaTest {
- public:
- PageInfoBubbleControllerTest() {
- controller_ = nil;
- model_ = new FakeModel();
- }
-
- virtual void TearDown() {
- [controller_ close];
- CocoaTest::TearDown();
- }
-
- void CreateBubble() {
- // The controller cleans up after itself when the window closes.
- controller_ =
- [[PageInfoBubbleController alloc]
- initWithPageInfoModel:model_
- modelObserver:NULL
- parentWindow:test_window()
- webContents:NULL
- navigator:NULL];
- window_ = [controller_ window];
- [controller_ showWindow:nil];
- }
-
- // Checks the controller's window for the requisite subviews in the given
- // numbers.
- void CheckWindow(int text_count,
- int image_count,
- int spacer_count,
- int button_count) {
- // All windows have the help center link and a spacer for it.
- int link_count = 1;
- ++spacer_count;
-
- // The window's only immediate child is an invisible view that has a flipped
- // coordinate origin. It is into this that all views get placed.
- NSArray* windowSubviews = [[window_ contentView] subviews];
- EXPECT_EQ(1U, [windowSubviews count]);
- NSArray* subviews = [[windowSubviews lastObject] subviews];
-
- for (NSView* view in subviews) {
- if ([view isKindOfClass:[NSTextField class]]) {
- --text_count;
- } else if ([view isKindOfClass:[NSImageView class]]) {
- --image_count;
- } else if ([view isKindOfClass:[NSBox class]]) {
- --spacer_count;
- } else if ([view isKindOfClass:[NSButton class]]) {
- NSButton* button = static_cast<NSButton*>(view);
- // Every window should have a single link button to the help page.
- if ([[button cell] isKindOfClass:[HyperlinkButtonCell class]]) {
- --link_count;
- CheckButton(button, @selector(showHelpPage:));
- } else {
- --button_count;
- CheckButton(button, @selector(showCertWindow:));
- }
- } else {
- ADD_FAILURE() << "Unknown subview: " << [[view description] UTF8String];
- }
- }
- EXPECT_EQ(0, text_count);
- EXPECT_EQ(0, image_count);
- EXPECT_EQ(0, spacer_count);
- EXPECT_EQ(0, button_count);
- EXPECT_EQ(0, link_count);
- EXPECT_EQ([window_ delegate], controller_);
- }
-
- // Checks that a button is hooked up correctly.
- void CheckButton(NSButton* button, SEL action) {
- EXPECT_EQ(action, [button action]);
- EXPECT_EQ(controller_, [button target]);
- EXPECT_TRUE([button stringValue]);
- }
-
- PageInfoBubbleController* controller_; // Weak, owns self.
- FakeModel* model_; // Weak, owned by controller.
- NSWindow* window_; // Weak, owned by controller.
-};
-
-
-TEST_F(PageInfoBubbleControllerTest, NoHistoryNoSecurity) {
- model_->AddSection(PageInfoModel::ICON_STATE_ERROR,
- string16(),
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY),
- PageInfoModel::SECTION_INFO_IDENTITY);
- model_->AddSection(PageInfoModel::ICON_STATE_ERROR,
- string16(),
- l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
- ASCIIToUTF16("google.com")),
- PageInfoModel::SECTION_INFO_CONNECTION);
-
- CreateBubble();
- CheckWindow(/*text=*/2, /*image=*/2, /*spacer=*/1, /*button=*/0);
-}
-
-
-TEST_F(PageInfoBubbleControllerTest, HistoryNoSecurity) {
- model_->AddSection(PageInfoModel::ICON_STATE_ERROR,
- string16(),
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY),
- PageInfoModel::SECTION_INFO_IDENTITY);
- model_->AddSection(PageInfoModel::ICON_STATE_ERROR,
- string16(),
- l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
- ASCIIToUTF16("google.com")),
- PageInfoModel::SECTION_INFO_CONNECTION);
-
- // In practice, the history information comes later because it's queried
- // asynchronously, so replicate the double-build here.
- CreateBubble();
-
- model_->AddSection(PageInfoModel::ICON_STATE_ERROR,
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_INFO_TITLE),
- l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY),
- PageInfoModel::SECTION_INFO_FIRST_VISIT);
-
- [controller_ performLayout];
-
- CheckWindow(/*text=*/4, /*image=*/3, /*spacer=*/2, /*button=*/0);
-}
-
-
-TEST_F(PageInfoBubbleControllerTest, NoHistoryMixedSecurity) {
- model_->AddSection(PageInfoModel::ICON_STATE_OK,
- string16(),
- l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY,
- ASCIIToUTF16("Goat Security Systems")),
- PageInfoModel::SECTION_INFO_IDENTITY);
-
- // This string is super long and the text should overflow the default clip
- // region (kImageSize).
- string16 description = l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK,
- l10n_util::GetStringFUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT,
- ASCIIToUTF16("chrome.google.com"),
- base::IntToString16(1024)),
- l10n_util::GetStringUTF16(
- IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING));
-
- model_->AddSection(PageInfoModel::ICON_STATE_OK,
- string16(),
- description,
- PageInfoModel::SECTION_INFO_CONNECTION);
-
- CreateBubble();
- [controller_ setCertID:1];
- [controller_ performLayout];
-
- CheckWindow(/*text=*/2, /*image=*/2, /*spacer=*/1, /*button=*/1);
-
- // Look for the over-sized box.
- NSString* targetDesc = base::SysUTF16ToNSString(description);
- NSArray* subviews = [[window_ contentView] subviews];
- for (NSView* subview in subviews) {
- if ([subview isKindOfClass:[NSTextField class]]) {
- NSTextField* desc = static_cast<NSTextField*>(subview);
- if ([[desc stringValue] isEqualToString:targetDesc]) {
- // Typical box frame is ~55px, make sure this is extra large.
- EXPECT_LT(75, NSHeight([desc frame]));
- }
- }
- }
-}
-
-} // namespace
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index cf865e6..7924bee 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -78,7 +78,6 @@
#include "chrome/browser/ui/gtk/website_settings/website_settings_popup_gtk.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
-#include "chrome/browser/ui/page_info_bubble.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_notification_types.h"
@@ -1004,22 +1003,14 @@ void BrowserWindowGtk::WebContentsFocused(WebContents* contents) {
NOTIMPLEMENTED();
}
-void BrowserWindowGtk::ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history) {
- chrome::ShowPageInfoBubble(window_, web_contents, url, ssl, show_history,
- browser_.get());
-}
-
void BrowserWindowGtk::ShowWebsiteSettings(
Profile* profile,
content::WebContents* web_contents,
const GURL& url,
const content::SSLStatus& ssl,
bool show_history) {
- WebsiteSettingsPopupGtk::Show(GetNativeWindow(), profile,
- web_contents, url, ssl);
+ WebsiteSettingsPopupGtk::Show(GetNativeWindow(), profile,
+ web_contents, url, ssl);
}
void BrowserWindowGtk::ShowAppMenu() {
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
index bb98e9c..cfceac8 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.h
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -142,10 +142,6 @@ class BrowserWindowGtk
virtual void UserChangedTheme() OVERRIDE;
virtual int GetExtraRenderViewHeight() const OVERRIDE;
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE;
virtual void ShowWebsiteSettings(Profile* profile,
content::WebContents* web_contents,
const GURL& url,
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 1eb0f7d..4aafc40 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -1444,8 +1444,8 @@ gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender,
NOTREACHED();
return FALSE;
}
- chrome::ShowPageInfo(browser_, tab, nav_entry->GetURL(),
- nav_entry->GetSSL(), true);
+ chrome::ShowWebsiteSettings(browser_, tab, nav_entry->GetURL(),
+ nav_entry->GetSSL(), true);
return TRUE;
} else if (event->button == 2) {
// When the user middle clicks on the location icon, try to open the
diff --git a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc b/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
deleted file mode 100644
index f33adcd..0000000
--- a/chrome/browser/ui/gtk/page_info_bubble_gtk.cc
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <gtk/gtk.h>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/i18n/rtl.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/certificate_viewer.h"
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/page_info_model_observer.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/gtk/browser_toolbar_gtk.h"
-#include "chrome/browser/ui/gtk/browser_window_gtk.h"
-#include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
-#include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
-#include "chrome/browser/ui/gtk/gtk_theme_service.h"
-#include "chrome/browser/ui/gtk/gtk_util.h"
-#include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/ssl_status.h"
-#include "googleurl/src/gurl.h"
-#include "grit/generated_resources.h"
-#include "grit/locale_settings.h"
-#include "ui/base/gtk/gtk_hig_constants.h"
-#include "ui/base/l10n/l10n_util.h"
-
-using content::OpenURLParams;
-using content::SSLStatus;
-using content::WebContents;
-
-namespace {
-
-class PageInfoBubbleGtk : public PageInfoModelObserver,
- public BubbleDelegateGtk {
- public:
- PageInfoBubbleGtk(gfx::NativeWindow parent,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator);
- virtual ~PageInfoBubbleGtk();
-
- // PageInfoModelObserver implementation.
- virtual void OnPageInfoModelChanged() OVERRIDE;
-
- // BubbleDelegateGtk implementation.
- virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
-
- private:
- // Layouts the different sections retrieved from the model.
- void InitContents();
-
- // Returns a widget that contains the UI for the passed |section|.
- GtkWidget* CreateSection(const PageInfoModel::SectionInfo& section);
-
- // Link button callbacks.
- CHROMEGTK_CALLBACK_0(PageInfoBubbleGtk, void, OnViewCertLinkClicked);
- CHROMEGTK_CALLBACK_0(PageInfoBubbleGtk, void, OnHelpLinkClicked);
-
- // The model containing the different sections to display.
- PageInfoModel model_;
-
- // The url for this dialog. Should be unique among active dialogs.
- GURL url_;
-
- // The id of the certificate for this page.
- int cert_id_;
-
- // Parent window.
- GtkWindow* parent_;
-
- // The virtual box containing the sections.
- GtkWidget* contents_;
-
- // The widget relative to which we are positioned.
- GtkWidget* anchor_;
-
- // Provides colors and stuff.
- GtkThemeService* theme_service_;
-
- BubbleGtk* bubble_;
-
- WebContents* web_contents_;
-
- // Used for loading pages.
- content::PageNavigator* navigator_;
-
- DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk);
-};
-
-PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator)
- : ALLOW_THIS_IN_INITIALIZER_LIST(model_(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()), url,
- ssl, show_history, this)),
- url_(url),
- cert_id_(ssl.cert_id),
- parent_(parent),
- contents_(NULL),
- theme_service_(GtkThemeService::GetFrom(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()))),
- web_contents_(web_contents),
- navigator_(navigator) {
- BrowserWindowGtk* browser_window =
- BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent);
-
- anchor_ = browser_window->
- GetToolbar()->GetLocationBarView()->location_icon_widget();
-
- InitContents();
-
- bubble_ = BubbleGtk::Show(anchor_,
- NULL, // |rect|
- contents_,
- BubbleGtk::ANCHOR_TOP_LEFT,
- BubbleGtk::MATCH_SYSTEM_THEME |
- BubbleGtk::POPUP_WINDOW |
- BubbleGtk::GRAB_INPUT,
- theme_service_,
- this); // |delegate|
- if (!bubble_) {
- NOTREACHED();
- return;
- }
-}
-
-PageInfoBubbleGtk::~PageInfoBubbleGtk() {
-}
-
-void PageInfoBubbleGtk::OnPageInfoModelChanged() {
- InitContents();
-}
-
-void PageInfoBubbleGtk::BubbleClosing(BubbleGtk* bubble,
- bool closed_by_escape) {
- delete this;
-}
-
-void PageInfoBubbleGtk::InitContents() {
- if (!contents_) {
- contents_ = gtk_vbox_new(FALSE, ui::kContentAreaSpacing);
- gtk_container_set_border_width(GTK_CONTAINER(contents_),
- ui::kContentAreaBorder);
- } else {
- gtk_util::RemoveAllChildren(contents_);
- }
-
- for (int i = 0; i < model_.GetSectionCount(); i++) {
- gtk_box_pack_start(GTK_BOX(contents_),
- CreateSection(model_.GetSectionInfo(i)),
- FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(contents_),
- gtk_hseparator_new(),
- FALSE, FALSE, 0);
- }
-
- GtkWidget* help_link = theme_service_->BuildChromeLinkButton(
- l10n_util::GetStringUTF8(IDS_PAGE_INFO_HELP_CENTER_LINK));
- GtkWidget* help_link_hbox = gtk_hbox_new(FALSE, 0);
- // Stick it in an hbox so it doesn't expand to the whole width.
- gtk_box_pack_start(GTK_BOX(help_link_hbox), help_link, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(contents_), help_link_hbox, FALSE, FALSE, 0);
- g_signal_connect(help_link, "clicked",
- G_CALLBACK(OnHelpLinkClickedThunk), this);
-
- gtk_widget_show_all(contents_);
-}
-
-GtkWidget* PageInfoBubbleGtk::CreateSection(
- const PageInfoModel::SectionInfo& section) {
- GtkWidget* section_box = gtk_hbox_new(FALSE, ui::kControlSpacing);
-
- GdkPixbuf* pixbuf = model_.GetIconImage(section.icon_id)->ToGdkPixbuf();
- if (pixbuf) {
- GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
- gtk_box_pack_start(GTK_BOX(section_box), image, FALSE, FALSE, 0);
- gtk_misc_set_alignment(GTK_MISC(image), 0, 0);
- }
-
- GtkWidget* vbox = gtk_vbox_new(FALSE, ui::kControlSpacing);
- gtk_box_pack_start(GTK_BOX(section_box), vbox, TRUE, TRUE, 0);
-
- if (!section.headline.empty()) {
- GtkWidget* label = theme_service_->BuildLabel(
- UTF16ToUTF8(section.headline), ui::kGdkBlack);
- gtk_label_set_selectable(GTK_LABEL(label), TRUE);
- PangoAttrList* attributes = pango_attr_list_new();
- pango_attr_list_insert(attributes,
- pango_attr_weight_new(PANGO_WEIGHT_BOLD));
- gtk_label_set_attributes(GTK_LABEL(label), attributes);
- pango_attr_list_unref(attributes);
- gtk_util::SetLabelWidth(label, 400);
- // Allow linebreaking in the middle of words if necessary, so that extremely
- // long hostnames (longer than one line) will still be completely shown.
- gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
- }
- GtkWidget* label = theme_service_->BuildLabel(
- UTF16ToUTF8(section.description), ui::kGdkBlack);
- gtk_label_set_selectable(GTK_LABEL(label), TRUE);
- gtk_util::SetLabelWidth(label, 400);
- // Allow linebreaking in the middle of words if necessary, so that extremely
- // long hostnames (longer than one line) will still be completely shown.
- gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-
- if (section.type == PageInfoModel::SECTION_INFO_IDENTITY && cert_id_ > 0) {
- GtkWidget* view_cert_link = theme_service_->BuildChromeLinkButton(
- l10n_util::GetStringUTF8(IDS_PAGEINFO_CERT_INFO_BUTTON));
- GtkWidget* cert_link_hbox = gtk_hbox_new(FALSE, 0);
- // Stick it in an hbox so it doesn't expand to the whole width.
- gtk_box_pack_start(GTK_BOX(cert_link_hbox), view_cert_link,
- FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), cert_link_hbox, FALSE, FALSE, 0);
- g_signal_connect(view_cert_link, "clicked",
- G_CALLBACK(OnViewCertLinkClickedThunk), this);
- }
-
- return section_box;
-}
-
-void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) {
- ShowCertificateViewerByID(web_contents_, GTK_WINDOW(parent_), cert_id_);
- bubble_->Close();
-}
-
-void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) {
- navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
- content::Referrer(),
- NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK,
- false));
- bubble_->Close();
-}
-
-} // namespace
-
-namespace chrome {
-
-void ShowPageInfoBubble(gfx::NativeWindow parent,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator) {
- new PageInfoBubbleGtk(
- parent, web_contents, url, ssl, show_history, navigator);
-}
-
-} // namespace chrome
diff --git a/chrome/browser/ui/page_info_bubble.h b/chrome/browser/ui/page_info_bubble.h
deleted file mode 100644
index 2600c3e..0000000
--- a/chrome/browser/ui/page_info_bubble.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_PAGE_INFO_BUBBLE_H_
-#define CHROME_BROWSER_UI_PAGE_INFO_BUBBLE_H_
-
-#include "ui/gfx/native_widget_types.h"
-
-class GURL;
-
-namespace content {
-class PageNavigator;
-class WebContents;
-struct SSLStatus;
-}
-
-namespace chrome {
-
-void ShowPageInfoBubble(gfx::NativeWindow parent,
- content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator);
-
-} // namespace chrome
-
-#endif // CHROME_BROWSER_UI_PAGE_INFO_BUBBLE_H_
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h
index 4a63caa..ba64b26 100644
--- a/chrome/browser/ui/views/browser_dialogs.h
+++ b/chrome/browser/ui/views/browser_dialogs.h
@@ -54,14 +54,6 @@ void ShowChromeToMobileBubbleView(views::View* anchor_view, Browser* browser);
void HideChromeToMobileBubbleView();
bool IsChromeToMobileBubbleViewShowing();
-// Shows the page info bubble anchored to the supplied view.
-void ShowPageInfoBubble(views::View* anchor_view,
- content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator);
-
// Creates and returns a find bar for the given browser window. See FindBarWin.
FindBar* CreateFindBar(BrowserView* browser_view);
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index a9ae54d..8d46e80 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1186,14 +1186,6 @@ void BrowserView::WebContentsFocused(WebContents* contents) {
devtools_container_->OnWebContentsFocused(contents);
}
-void BrowserView::ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history) {
- chrome::ShowPageInfoBubble(GetLocationBarView()->location_icon_view(),
- web_contents, url, ssl, show_history, browser_.get());
-}
-
void BrowserView::ShowWebsiteSettings(Profile* profile,
content::WebContents* web_contents,
const GURL& url,
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 036709b..c6fd649 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -328,10 +328,6 @@ class BrowserView : public BrowserWindow,
virtual void UserChangedTheme() OVERRIDE;
virtual int GetExtraRenderViewHeight() const OVERRIDE;
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE;
virtual void ShowWebsiteSettings(Profile* profile,
content::WebContents* web_contents,
const GURL& url,
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index e59a713..69bb021 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -105,11 +105,11 @@ class LocationBarView : public LocationBar,
virtual ContentSettingBubbleModelDelegate*
GetContentSettingBubbleModelDelegate() = 0;
- // Shows page information in the given web contents.
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) = 0;
+ // Shows permissions and settings for the given web contents.
+ virtual void ShowWebsiteSettings(content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history) = 0;
// Called by the location bar view when the user starts typing in the edit.
// This forces our security style to be UNKNOWN for the duration of the
diff --git a/chrome/browser/ui/views/location_bar/page_info_helper.cc b/chrome/browser/ui/views/location_bar/page_info_helper.cc
index 87f5eea..52bf7fc 100644
--- a/chrome/browser/ui/views/location_bar/page_info_helper.cc
+++ b/chrome/browser/ui/views/location_bar/page_info_helper.cc
@@ -40,6 +40,6 @@ void PageInfoHelper::ProcessEvent(const ui::LocatedEvent& event) {
return;
}
- location_bar_->delegate()->ShowPageInfo(
+ location_bar_->delegate()->ShowWebsiteSettings(
tab, nav_entry->GetURL(), nav_entry->GetSSL(), true);
}
diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc
deleted file mode 100644
index 0248b8c..0000000
--- a/chrome/browser/ui/views/page_info_bubble_view.cc
+++ /dev/null
@@ -1,478 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/page_info_bubble_view.h"
-
-#include <algorithm>
-
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/certificate_viewer.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "chrome/browser/ui/views/toolbar_view.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/cert_store.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/ssl_status.h"
-#include "grit/generated_resources.h"
-#include "grit/locale_settings.h"
-#include "net/base/x509_certificate.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/range/range.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/controls/link.h"
-#include "ui/views/controls/separator.h"
-#include "ui/views/layout/grid_layout.h"
-#include "ui/views/widget/widget.h"
-
-using content::OpenURLParams;
-using content::Referrer;
-using content::SSLStatus;
-using content::WebContents;
-
-namespace {
-
-// Layout constants.
-const int kHGapToBorder = 11;
-const int kVerticalSectionPadding = 8;
-const int kVGapToHeadline = 5;
-const int kHGapImageToDescription = 6;
-const int kTextPaddingRight = 10;
-const int kPaddingBelowSeparator = 6;
-const int kPaddingAboveSeparator = 4;
-const int kIconHorizontalOffset = 27;
-const int kIconVerticalOffset = -7;
-
-// The duration of the animation that resizes the bubble once the async
-// information is provided through the ModelChanged event.
-const int kPageInfoSlideDuration = 250;
-
-// A section contains an image that shows a status (good or bad), a title, an
-// optional head-line (in bold) and a description.
-class Section : public views::View,
- public views::LinkListener {
- public:
- Section(PageInfoBubbleView* owner,
- const PageInfoModel::SectionInfo& section_info,
- const gfx::ImageSkia* status_icon,
- bool show_cert);
- virtual ~Section();
-
- // Notify the section how far along in the animation we are. This is used
- // to draw the section opaquely onto the canvas, to animate the section into
- // view.
- void SetAnimationStage(double animation_stage);
-
- // views::View methods:
- virtual int GetHeightForWidth(int w) OVERRIDE;
- virtual void Layout() OVERRIDE;
- virtual void Paint(gfx::Canvas* canvas) OVERRIDE;
-
- // views::LinkListener methods:
- virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
-
- private:
- // Calculate the animation value to use for setting the opacity.
- double OpacityAnimationValue();
-
- // Calculate the layout if |compute_bounds_only|, otherwise does Layout also.
- gfx::Size LayoutItems(bool compute_bounds_only, int width);
-
- // The view that owns this Section object.
- PageInfoBubbleView* owner_;
-
- // The information this view represents.
- PageInfoModel::SectionInfo info_;
-
- views::ImageView* status_image_;
- views::Textfield* headline_label_;
- views::Label* description_label_;
- views::Link* link_;
-
- // The level of animation we are currently at.
- double animation_value_;
-
- DISALLOW_COPY_AND_ASSIGN(Section);
-};
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-// PageInfoBubbleView
-
-PageInfoBubbleView::PageInfoBubbleView(views::View* anchor_view,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator)
- : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT),
- ALLOW_THIS_IN_INITIALIZER_LIST(model_(
- Profile::FromBrowserContext(web_contents->GetBrowserContext()), url,
- ssl, show_history, this)),
- cert_id_(ssl.cert_id),
- help_center_link_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(resize_animation_(this)),
- animation_start_height_(0),
- navigator_(navigator),
- web_contents_(web_contents) {
- // Compensate for built-in vertical padding in the anchor view's image.
- set_anchor_insets(gfx::Insets(5, 0, 5, 0));
-
- if (cert_id_ > 0) {
- scoped_refptr<net::X509Certificate> cert;
- content::CertStore::GetInstance()->RetrieveCert(cert_id_, &cert);
- // When running with fake certificate (Chrome Frame), we have no os
- // certificate, so there is no cert to show. Don't bother showing the cert
- // info link in that case.
- if (!cert.get() || !cert->os_cert_handle())
- cert_id_ = 0;
- }
- LayoutSections();
-}
-
-PageInfoBubbleView::~PageInfoBubbleView() {
- resize_animation_.Reset();
-}
-
-void PageInfoBubbleView::ShowCertDialog() {
- gfx::NativeWindow parent =
- anchor_view() ? anchor_view()->GetWidget()->GetNativeWindow() : NULL;
- ShowCertificateViewerByID(web_contents_, parent, cert_id_);
-}
-
-gfx::Size PageInfoBubbleView::GetSeparatorSize() {
- // Calculate how much space the separators take up (with padding).
- views::Separator separator;
- gfx::Size separator_size = separator.GetPreferredSize();
- gfx::Size separator_plus_padding(0, separator_size.height() +
- kPaddingAboveSeparator +
- kPaddingBelowSeparator);
- return separator_plus_padding;
-}
-
-double PageInfoBubbleView::GetResizeAnimationCurrentValue() {
- return resize_animation_.GetCurrentValue();
-}
-
-double PageInfoBubbleView::HeightAnimationValue() {
- // We use the first half of the animation to get to fully expanded mode.
- // Towards the end, we also animate the section into view, as determined
- // by OpacityAnimationValue().
- return std::min(1.0, 2.0 * GetResizeAnimationCurrentValue());
-}
-
-void PageInfoBubbleView::LayoutSections() {
- // Remove all the existing sections.
- RemoveAllChildViews(true);
-
- views::GridLayout* layout = new views::GridLayout(this);
- SetLayoutManager(layout);
- views::ColumnSet* columns = layout->AddColumnSet(0);
- columns->AddColumn(views::GridLayout::FILL, // Horizontal resize.
- views::GridLayout::FILL, // Vertical resize.
- 1, // Resize weight.
- views::GridLayout::USE_PREF, // Size type.
- 0, // Ignored for USE_PREF.
- 0); // Minimum size.
- // Add a column set for aligning the text when it has no icons (such as the
- // help center link).
- columns = layout->AddColumnSet(1);
- columns->AddPaddingColumn(
- 0, kHGapToBorder + kIconHorizontalOffset + kHGapImageToDescription);
- columns->AddColumn(views::GridLayout::LEADING, // Horizontal resize.
- views::GridLayout::FILL, // Vertical resize.
- 1, // Resize weight.
- views::GridLayout::USE_PREF, // Size type.
- 0, // Ignored for USE_PREF.
- 0); // Minimum size.
-
- int count = model_.GetSectionCount();
- bool only_internal_section = false;
- for (int i = 0; i < count; ++i) {
- PageInfoModel::SectionInfo info = model_.GetSectionInfo(i);
- if (count == 1 && info.type == PageInfoModel::SECTION_INFO_INTERNAL_PAGE)
- only_internal_section = true;
- layout->StartRow(0, 0);
- const gfx::ImageSkia* icon = model_.GetIconImage(
- info.icon_id)->ToImageSkia();
- Section* section = new Section(this, info, icon, cert_id_ > 0);
- if (info.type == PageInfoModel::SECTION_INFO_FIRST_VISIT) {
- // This section is animated into view, so we need to set the height of it
- // according to the animation stage, and let it know how transparent it
- // should draw itself.
- section->SetAnimationStage(GetResizeAnimationCurrentValue());
- gfx::Size sz(views::Widget::GetLocalizedContentsSize(
- IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES));
- layout->AddView(section,
- 1, 1, // Colspan & Rowspan.
- views::GridLayout::LEADING, views::GridLayout::LEADING,
- sz.width(),
- static_cast<int>(HeightAnimationValue() *
- section->GetHeightForWidth(sz.width())));
- } else {
- layout->AddView(section);
- }
-
- // Add separator after all sections, except internal info.
- if (!only_internal_section) {
- layout->AddPaddingRow(0, kPaddingAboveSeparator);
- layout->StartRow(0, 0);
- layout->AddView(new views::Separator());
- layout->AddPaddingRow(0, kPaddingBelowSeparator);
- }
- }
-
- // Then add the help center link at the bottom.
- if (!only_internal_section) {
- layout->StartRow(0, 1);
- help_center_link_ = new views::Link(
- l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK));
- help_center_link_->set_listener(this);
- layout->AddView(help_center_link_);
- }
-
- layout->Layout(this);
-}
-
-gfx::Size PageInfoBubbleView::GetPreferredSize() {
- gfx::Size size(views::Widget::GetLocalizedContentsSize(
- IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES));
- size.set_height(0);
-
- int count = model_.GetSectionCount();
- for (int i = 0; i < count; ++i) {
- PageInfoModel::SectionInfo info = model_.GetSectionInfo(i);
- const gfx::ImageSkia* icon = model_.GetIconImage(
- info.icon_id)->ToImageSkia();
- Section section(this, info, icon, cert_id_ > 0);
- size.Enlarge(0, section.GetHeightForWidth(size.width()));
- }
-
- static int separator_plus_padding = GetSeparatorSize().height();
-
- // Account for the separators and padding within sections.
- size.Enlarge(0, (count - 1) * separator_plus_padding);
-
- // Account for the Help Center link and the separator above it.
- if (help_center_link_) {
- gfx::Size link_size = help_center_link_->GetPreferredSize();
- size.Enlarge(0, separator_plus_padding +
- link_size.height());
- }
-
- if (!resize_animation_.is_animating())
- return size;
-
- // We are animating from animation_start_height_ to size.
- int target_height = animation_start_height_ + static_cast<int>(
- (size.height() - animation_start_height_) * HeightAnimationValue());
- size.set_height(target_height);
- return size;
-}
-
-void PageInfoBubbleView::OnPageInfoModelChanged() {
- // The start height must take into account that when we start animating,
- // a separator plus padding is immediately added before the view is animated
- // into existence.
- animation_start_height_ = bounds().height() + GetSeparatorSize().height();
- LayoutSections();
- resize_animation_.SetSlideDuration(kPageInfoSlideDuration);
- resize_animation_.Show();
-}
-
-void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) {
- navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
- Referrer(),
- NEW_FOREGROUND_TAB,
- content::PAGE_TRANSITION_LINK,
- false));
- // NOTE: The bubble closes automatically on deactivation as the link opens.
-}
-
-void PageInfoBubbleView::AnimationEnded(const ui::Animation* animation) {
- if (animation == &resize_animation_) {
- LayoutSections();
- SizeToContents();
- }
- BubbleDelegateView::AnimationEnded(animation);
-}
-
-void PageInfoBubbleView::AnimationProgressed(const ui::Animation* animation) {
- if (animation == &resize_animation_) {
- LayoutSections();
- SizeToContents();
- }
- BubbleDelegateView::AnimationProgressed(animation);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Section
-
-Section::Section(PageInfoBubbleView* owner,
- const PageInfoModel::SectionInfo& section_info,
- const gfx::ImageSkia* state_icon,
- bool show_cert)
- : owner_(owner),
- info_(section_info),
- status_image_(NULL),
- link_(NULL) {
- if (state_icon) {
- status_image_ = new views::ImageView();
- status_image_->SetImage(*state_icon);
- AddChildView(status_image_);
- }
-
- // This is a text field so that text can be selected and copied.
- headline_label_ = new views::Textfield();
- headline_label_->SetText(info_.headline);
- headline_label_->SetReadOnly(true);
- headline_label_->RemoveBorder();
- headline_label_->SetTextColor(SK_ColorBLACK);
- headline_label_->SetBackgroundColor(SK_ColorWHITE);
- headline_label_->SetFont(
- headline_label_->font().DeriveFont(0, gfx::Font::BOLD));
- AddChildView(headline_label_);
-
- // Can't make this a text field to enable copying until multiline support is
- // added to text fields.
- description_label_ = new views::Label(info_.description);
- description_label_->set_background(
- views::Background::CreateSolidBackground(SK_ColorWHITE));
- description_label_->SetMultiLine(true);
- description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- // Allow linebreaking in the middle of words if necessary, so that extremely
- // long hostnames (longer than one line) will still be completely shown.
- description_label_->SetAllowCharacterBreak(true);
- AddChildView(description_label_);
-
- if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) {
- link_ = new views::Link(
- l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON));
- link_->set_listener(this);
- AddChildView(link_);
- }
-}
-
-Section::~Section() {
-}
-
-void Section::SetAnimationStage(double animation_stage) {
- animation_value_ = animation_stage;
- SchedulePaint();
-}
-
-int Section::GetHeightForWidth(int width) {
- return LayoutItems(true, width).height();
-}
-
-void Section::Layout() {
- LayoutItems(false, width());
-}
-
-void Section::Paint(gfx::Canvas* canvas) {
- if (info_.type == PageInfoModel::SECTION_INFO_FIRST_VISIT) {
- // This section needs to be animated into view.
- canvas->SaveLayerAlpha(static_cast<int>(255.0 * OpacityAnimationValue()),
- bounds());
- }
-
- views::View::Paint(canvas);
-
- if (info_.type == PageInfoModel::SECTION_INFO_FIRST_VISIT)
- canvas->Restore();
-}
-
-void Section::LinkClicked(views::Link* source, int event_flags) {
- owner_->ShowCertDialog();
-}
-
-double Section::OpacityAnimationValue() {
- // We use the tail end of the animation to get to fully visible.
- // The first half of the animation is devoted to expanding the size of the
- // bubble, as determined by HeightAnimationValue().
- return std::max(0.0, std::min(1.0, 1.7 * animation_value_ - 1.0));
-}
-
-gfx::Size Section::LayoutItems(bool compute_bounds_only, int width) {
- int x = kHGapToBorder;
- int y = kVerticalSectionPadding;
-
- // Layout the image, head-line and description.
- gfx::Size size;
- if (status_image_) {
- size = status_image_->GetPreferredSize();
- if (!compute_bounds_only)
- status_image_->SetBounds(x, y, size.width(), size.height());
- }
- int image_height = size.height();
- x += size.width() + kHGapImageToDescription;
- int w = width - x - kTextPaddingRight;
- y = kVGapToHeadline;
- int headline_height = 0;
- if (!headline_label_->text().empty()) {
- size = headline_label_->GetPreferredSize();
- headline_height = size.height();
- if (!compute_bounds_only)
- headline_label_->SetBounds(x, y, w > 0 ? w : 0, size.height());
- y += size.height();
-
- // Show the leading headline text by moving the textfield cursor there,
- // otherwise long headlines may initially show the leading text truncated.
- // This can only be done after the textfield is initialized with the Widget.
- if (GetWidget())
- headline_label_->SelectRange(ui::Range());
- } else {
- if (!compute_bounds_only)
- headline_label_->SetBounds(x, y, 0, 0);
- }
- if (w > 0) {
- int height = description_label_->GetHeightForWidth(w);
- if (headline_height == 0 && height < image_height) {
- // Descriptions without headlines that take up less space vertically than
- // the image, should center align against the image.
- y = status_image_->y() + (image_height - height) / 2;
- }
- if (!compute_bounds_only)
- description_label_->SetBounds(x, y, w, height);
- y += height;
- } else {
- if (!compute_bounds_only)
- description_label_->SetBounds(x, y, 0, 0);
- }
- if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && link_) {
- size = link_->GetPreferredSize();
- if (!compute_bounds_only)
- link_->SetBounds(x, y, size.width(), size.height());
- y += size.height();
- }
-
- // Make sure the image is not truncated if the text doesn't contain much.
- y = std::max(y, (2 * kVerticalSectionPadding) + image_height);
- return gfx::Size(width, y);
-}
-
-namespace chrome {
-
-void ShowPageInfoBubble(views::View* anchor_view,
- WebContents* web_contents,
- const GURL& url,
- const SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator) {
- PageInfoBubbleView* page_info_bubble = new PageInfoBubbleView(anchor_view,
- web_contents,
- url,
- ssl,
- show_history,
- navigator);
- views::BubbleDelegateView::CreateBubble(page_info_bubble);
- page_info_bubble->Show();
-}
-
-} // namespace chrome
diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h
deleted file mode 100644
index ae6fdf1..0000000
--- a/chrome/browser/ui/views/page_info_bubble_view.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/page_info_model_observer.h"
-#include "ui/base/animation/slide_animation.h"
-#include "ui/views/bubble/bubble_delegate.h"
-#include "ui/views/controls/link_listener.h"
-
-namespace content {
-class PageNavigator;
-class WebContents;
-struct SSLStatus;
-}
-
-class PageInfoBubbleView : public views::BubbleDelegateView,
- public PageInfoModelObserver,
- public views::LinkListener {
- public:
- PageInfoBubbleView(views::View* anchor_view,
- content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history,
- content::PageNavigator* navigator);
- virtual ~PageInfoBubbleView();
-
- // Show the certificate dialog.
- void ShowCertDialog();
-
- // views::View methods:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- // PageInfoModelObserver methods:
- virtual void OnPageInfoModelChanged() OVERRIDE;
-
- // views::LinkListener methods:
- virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
-
- // ui::AnimationDelegate methods:
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
-
- private:
- // Gets the size of the separator, including padding.
- gfx::Size GetSeparatorSize();
-
- // Get the current value of |resize_animation_| (in [0.0, 1.0]).
- double GetResizeAnimationCurrentValue();
-
- // Gets the animation value to use for setting the height.
- double HeightAnimationValue();
-
- // Layout the sections within the bubble.
- void LayoutSections();
-
- // The model providing the various section info.
- PageInfoModel model_;
-
- // The id of the certificate for this page.
- int cert_id_;
-
- // The Help Center link at the bottom of the bubble.
- views::Link* help_center_link_;
-
- // Animation that helps us change size smoothly as more data comes in.
- ui::SlideAnimation resize_animation_;
-
- // The height of the info bubble at the start of the resize animation.
- int animation_start_height_;
-
- // Used for loading pages.
- content::PageNavigator* navigator_;
-
- content::WebContents* web_contents_;
-
- DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleView);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/views/script_bubble_view.h b/chrome/browser/ui/views/script_bubble_view.h
index a578c11..042986f 100644
--- a/chrome/browser/ui/views/script_bubble_view.h
+++ b/chrome/browser/ui/views/script_bubble_view.h
@@ -9,8 +9,6 @@
#include <string>
#include "base/compiler_specific.h"
-#include "chrome/browser/page_info_model.h"
-#include "chrome/browser/page_info_model_observer.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/gfx/image/image.h"
#include "ui/views/bubble/bubble_delegate.h"
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index c5cd1c2e..31a19cc 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -462,11 +462,11 @@ ToolbarView::GetContentSettingBubbleModelDelegate() {
return browser_->content_setting_bubble_model_delegate();
}
-void ToolbarView::ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) {
- chrome::ShowPageInfo(browser_, web_contents, url, ssl, show_history);
+void ToolbarView::ShowWebsiteSettings(content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history) {
+ chrome::ShowWebsiteSettings(browser_, web_contents, url, ssl, show_history);
}
views::Widget* ToolbarView::CreateViewsBubble(
diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h
index 3010a39..1cad20e 100644
--- a/chrome/browser/ui/views/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar_view.h
@@ -103,10 +103,10 @@ class ToolbarView : public views::AccessiblePaneView,
LocationBarView* owner, ExtensionAction* action) OVERRIDE;
virtual ContentSettingBubbleModelDelegate*
GetContentSettingBubbleModelDelegate() OVERRIDE;
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE;
+ virtual void ShowWebsiteSettings(content::WebContents* web_contents,
+ const GURL& url,
+ const content::SSLStatus& ssl,
+ bool show_history) OVERRIDE;
virtual void OnInputInProgress(bool in_progress) OVERRIDE;
// Overridden from CommandObserver:
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ddc854c..fe9dfc9 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1218,9 +1218,6 @@
'browser/omnibox_search_hint.h',
'browser/page_cycler/page_cycler.cc',
'browser/page_cycler/page_cycler.h',
- 'browser/page_info_model.cc',
- 'browser/page_info_model.h',
- 'browser/page_info_model_observer.h',
'browser/parsers/metadata_parser.cc',
'browser/parsers/metadata_parser.h',
'browser/parsers/metadata_parser_factory.h',
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 404e11e..47193e5 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -680,8 +680,6 @@
'browser/ui/cocoa/one_click_signin_bubble_controller.mm',
'browser/ui/cocoa/other_device_menu_cocoa.h',
'browser/ui/cocoa/other_device_menu_cocoa.mm',
- 'browser/ui/cocoa/page_info_bubble_controller.h',
- 'browser/ui/cocoa/page_info_bubble_controller.mm',
'browser/ui/cocoa/panels/display_settings_provider_cocoa.mm',
'browser/ui/cocoa/panels/mouse_drag_controller.h',
'browser/ui/cocoa/panels/mouse_drag_controller.mm',
@@ -1049,7 +1047,6 @@
'browser/ui/gtk/other_device_menu_gtk.h',
'browser/ui/gtk/overflow_button.cc',
'browser/ui/gtk/overflow_button.h',
- 'browser/ui/gtk/page_info_bubble_gtk.cc',
'browser/ui/gtk/panels/display_settings_provider_gtk.cc',
'browser/ui/gtk/panels/panel_drag_gtk.cc',
'browser/ui/gtk/panels/panel_drag_gtk.h',
@@ -1175,7 +1172,6 @@
'browser/ui/omnibox/omnibox_view.h',
'browser/ui/options/options_util.cc',
'browser/ui/options/options_util.h',
- 'browser/ui/page_info_bubble.h',
'browser/ui/panels/detached_panel_collection.cc',
'browser/ui/panels/detached_panel_collection.h',
'browser/ui/panels/detached_panel_drag_handler.cc',
@@ -1665,8 +1661,6 @@
'browser/ui/views/open_pdf_in_reader_bubble_view.h',
'browser/ui/views/other_device_menu_views.cc',
'browser/ui/views/other_device_menu_views.h',
- 'browser/ui/views/page_info_bubble_view.cc',
- 'browser/ui/views/page_info_bubble_view.h',
'browser/ui/views/panels/panel_frame_view.cc',
'browser/ui/views/panels/panel_frame_view.h',
'browser/ui/views/panels/panel_stack_view.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 9aa2500..ca40e6d 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1299,7 +1299,6 @@
'browser/ui/cocoa/omnibox/omnibox_popup_view_mac_unittest.mm',
'browser/ui/cocoa/omnibox/omnibox_view_mac_unittest.mm',
'browser/ui/cocoa/one_click_signin_bubble_controller_unittest.mm',
- 'browser/ui/cocoa/page_info_bubble_controller_unittest.mm',
'browser/ui/cocoa/panels/panel_cocoa_unittest.mm',
'browser/ui/cocoa/profile_menu_controller_unittest.mm',
'browser/ui/cocoa/ratings_view_unittest.mm',
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index 7817474..3d541e3 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -109,10 +109,6 @@ class TestBrowserWindow : public BrowserWindow {
virtual void UserChangedTheme() OVERRIDE {}
virtual int GetExtraRenderViewHeight() const OVERRIDE;
virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE {}
- virtual void ShowPageInfo(content::WebContents* web_contents,
- const GURL& url,
- const content::SSLStatus& ssl,
- bool show_history) OVERRIDE {}
virtual void ShowWebsiteSettings(Profile* profile,
content::WebContents* web_contents,
const GURL& url,