diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 27 | ||||
-rw-r--r-- | chrome/browser/chrome_content_browser_client.h | 3 | ||||
-rw-r--r-- | chrome/browser/clipboard_dispatcher.h | 41 | ||||
-rw-r--r-- | chrome/browser/clipboard_dispatcher_gtk.cc | 32 | ||||
-rw-r--r-- | chrome/browser/clipboard_dispatcher_mac.mm | 33 | ||||
-rw-r--r-- | chrome/browser/clipboard_dispatcher_win.cc | 32 | ||||
-rw-r--r-- | chrome/browser/printing/print_preview_message_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/chrome_render_view_host_observer.cc | 1 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/tab_contents_wrapper.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/tab_contents_wrapper.h | 6 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/new_tab_ui.cc | 28 |
13 files changed, 79 insertions, 142 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 4a6a335..f3cb9709 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -4,10 +4,13 @@ #include "chrome/browser/chrome_content_browser_client.h" +#include "chrome/browser/character_encoding.h" #include "chrome/browser/debugger/devtools_handler.h" #include "chrome/browser/desktop_notification_handler.h" #include "chrome/browser/extensions/extension_message_handler.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/google/google_util.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/printing/printing_message_filter.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" @@ -15,8 +18,10 @@ #include "chrome/browser/search_engines/search_provider_install_state_message_filter.h" #include "chrome/browser/spellcheck_message_filter.h" #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" +#include "chrome/common/pref_names.h" #include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/tab_contents/tab_contents.h" namespace chrome { @@ -81,4 +86,26 @@ GURL ChromeContentBrowserClient::GetEffectiveURL(Profile* profile, return extension->GetResourceURL(url.path()); } +GURL ChromeContentBrowserClient::GetAlternateErrorPageURL( + const TabContents* tab) { + GURL url; + // Disable alternate error pages when in OffTheRecord/Incognito mode. + if (tab->profile()->IsOffTheRecord()) + return url; + + PrefService* prefs = tab->profile()->GetPrefs(); + DCHECK(prefs); + if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { + url = google_util::AppendGoogleLocaleParam( + GURL(google_util::kLinkDoctorBaseURL)); + url = google_util::AppendGoogleTLDParam(url); + } + return url; +} + +std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) { + return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); +} + } // namespace chrome diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 6e69a4a..8b96a44 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -19,6 +19,9 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { virtual void BrowserRenderProcessHostCreated(BrowserRenderProcessHost* host); virtual content::WebUIFactory* GetWebUIFactory(); virtual GURL GetEffectiveURL(Profile* profile, const GURL& url); + virtual GURL GetAlternateErrorPageURL(const TabContents* tab); + virtual std::string GetCanonicalEncodingNameByAliasName( + const std::string& alias_name); }; } // namespace chrome diff --git a/chrome/browser/clipboard_dispatcher.h b/chrome/browser/clipboard_dispatcher.h deleted file mode 100644 index 3ca3281..0000000 --- a/chrome/browser/clipboard_dispatcher.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2010 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_CLIPBOARD_DISPATCHER_H_ -#define CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_ -#pragma once - -#include <vector> - -#include "base/basictypes.h" -#include "base/string16.h" -#include "ui/base/clipboard/clipboard.h" - -// This class backs IPC requests from the renderer for clipboard data. In this -// context, clipboard does not only refer to the usual concept of a clipboard -// for copy/paste, which is why it's not in app/clipboard/clipboard.h. It can -// refer to one of three different types of clipboards: -// - The copy/paste clipboard, which contains data that has been copied/cut. -// - The dragging clipboard, which contains data that is currently being -// dragged. -// - On X, the selection clipboard, which contains data for the current -// selection. -class ClipboardDispatcher { - public: - static bool ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, - bool* contains_filenames); - static bool ReadData(ui::Clipboard::Buffer buffer, const string16& type, - string16* data, string16* metadata); - static bool ReadFilenames(ui::Clipboard::Buffer buffer, - std::vector<string16>* filenames); - - private: - // This class is not meant to be instantiated. All public members are static. - ClipboardDispatcher(); - - DISALLOW_COPY_AND_ASSIGN(ClipboardDispatcher); -}; - -#endif // CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_ diff --git a/chrome/browser/clipboard_dispatcher_gtk.cc b/chrome/browser/clipboard_dispatcher_gtk.cc deleted file mode 100644 index f5a456f..0000000 --- a/chrome/browser/clipboard_dispatcher_gtk.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2010 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/clipboard_dispatcher.h" -#include "base/logging.h" - -bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, - bool* contains_filenames) { - DCHECK(types); - DCHECK(contains_filenames); - types->clear(); - *contains_filenames = false; - return false; -} - -bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data, - string16* metadata) { - DCHECK(data); - DCHECK(metadata); - return false; -} - -bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, - std::vector<string16>* filenames) { - DCHECK(filenames); - filenames->clear(); - return false; -} diff --git a/chrome/browser/clipboard_dispatcher_mac.mm b/chrome/browser/clipboard_dispatcher_mac.mm deleted file mode 100644 index e91f452..0000000 --- a/chrome/browser/clipboard_dispatcher_mac.mm +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2010 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/clipboard_dispatcher.h" -#include "base/logging.h" - -bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, - bool* contains_filenames) { - DCHECK(types); - DCHECK(contains_filenames); - types->clear(); - *contains_filenames = false; - return false; -} - -bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data, - string16* metadata) { - DCHECK(data); - DCHECK(metadata); - return false; -} - -bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, - std::vector<string16>* filenames) { - DCHECK(filenames); - filenames->clear(); - return false; -} - diff --git a/chrome/browser/clipboard_dispatcher_win.cc b/chrome/browser/clipboard_dispatcher_win.cc deleted file mode 100644 index f5a456f..0000000 --- a/chrome/browser/clipboard_dispatcher_win.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2010 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/clipboard_dispatcher.h" -#include "base/logging.h" - -bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<string16>* types, - bool* contains_filenames) { - DCHECK(types); - DCHECK(contains_filenames); - types->clear(); - *contains_filenames = false; - return false; -} - -bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, - const string16& type, - string16* data, - string16* metadata) { - DCHECK(data); - DCHECK(metadata); - return false; -} - -bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, - std::vector<string16>* filenames) { - DCHECK(filenames); - filenames->clear(); - return false; -} diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc index 096551b..7c1f171 100644 --- a/chrome/browser/printing/print_preview_message_handler.cc +++ b/chrome/browser/printing/print_preview_message_handler.cc @@ -13,11 +13,11 @@ #include "chrome/browser/ui/webui/print_preview_handler.h" #include "chrome/browser/ui/webui/print_preview_ui.h" #include "chrome/browser/ui/webui/print_preview_ui_html_source.h" -#include "chrome/common/content_restriction.h" #include "chrome/common/print_messages.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_restriction.h" namespace { diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc index bc68b84..8e8fb8e 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -7,6 +7,7 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/common/render_messages.h" #include "content/common/notification_service.h" +#include "content/common/view_messages.h" ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( RenderViewHost* render_view_host) diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 38464a3..9b5e9f5 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -44,7 +44,6 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/content_restriction.h" #include "chrome/common/pref_names.h" #include "chrome/common/print_messages.h" #include "chrome/common/spellcheck_messages.h" @@ -55,6 +54,7 @@ #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" +#include "content/common/content_restriction.h" #include "grit/generated_resources.h" #include "net/base/escape.h" #include "net/url_request/url_request.h" diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index e24aaff..1d069a0 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -98,7 +98,6 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/content_restriction.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" @@ -114,6 +113,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/user_metrics.h" +#include "content/common/content_restriction.h" #include "content/common/notification_service.h" #include "content/common/page_transition_types.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index 7e9fe49..ca17ac0 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -17,8 +17,10 @@ #include "chrome/browser/file_select_helper.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/top_sites.h" +#include "chrome/browser/omnibox_search_hint.h" #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/password_manager_delegate_impl.h" +#include "chrome/browser/pdf_unsupported_feature.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prerender/prerender_observer.h" #include "chrome/browser/printing/print_preview_message_handler.h" @@ -93,6 +95,10 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents) thumbnail_generation_observer_.reset(new ThumbnailGenerator); thumbnail_generation_observer_->StartThumbnailing(tab_contents_.get()); } + + // Set-up the showing of the omnibox search infobar if applicable. + if (OmniboxSearchHint::IsEnabled(contents->profile())) + omnibox_search_hint_.reset(new OmniboxSearchHint(contents)); } TabContentsWrapper::~TabContentsWrapper() { @@ -244,6 +250,8 @@ bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { OnRegisterProtocolHandler) IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnThumbnail) IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnSnapshot) + IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, + OnPDFHasUnsupportedFeature) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -342,6 +350,10 @@ void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { Details<const SkBitmap>(&bitmap)); } +void TabContentsWrapper::OnPDFHasUnsupportedFeature() { + PDFHasUnsupportedFeature(tab_contents()); +} + void TabContentsWrapper::UpdateStarredStateForCurrentURL() { BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); const bool old_state = is_starred_; diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h index dc2072d..a90366c 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h @@ -35,6 +35,7 @@ class ExtensionWebNavigationTabObserver; class FileSelectObserver; class FindTabHelper; class NavigationController; +class OmniboxSearchHint; class PasswordManager; class PasswordManagerDelegate; class SearchEngineTabHelper; @@ -167,6 +168,7 @@ class TabContentsWrapper : public NotificationObserver, const ThumbnailScore& score, const SkBitmap& bitmap); void OnSnapshot(const SkBitmap& bitmap); + void OnPDFHasUnsupportedFeature(); // Updates the starred state from the bookmark bar model. If the state has // changed, the delegate is notified. @@ -185,6 +187,10 @@ class TabContentsWrapper : public NotificationObserver, // Whether the current URL is starred. bool is_starred_; + // Shows an info-bar to users when they search from a known search engine and + // have never used the monibox for search before. + scoped_ptr<OmniboxSearchHint> omnibox_search_hint_; + // Tab Helpers --------------------------------------------------------------- // (These provide API for callers and have a getter function listed in the // "Tab Helpers" section in the member functions area, above.) diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 8b4fba0..1adf55f 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -16,6 +16,7 @@ #include "base/string_number_conversions.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/metrics/metric_event_duration_details.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_types.h" @@ -206,7 +207,32 @@ void MetricsHandler::HandleMetrics(const ListValue* args) { void MetricsHandler::HandleLogEventTime(const ListValue* args) { std::string event_name = UTF16ToUTF8(ExtractStringValue(args)); - web_ui_->tab_contents()->LogNewTabTime(event_name); + TabContents* tab = web_ui_->tab_contents(); + + // Not all new tab pages get timed. In those cases, we don't have a + // new_tab_start_time_. + if (tab->new_tab_start_time().is_null()) + return; + + base::TimeDelta duration = base::TimeTicks::Now() - tab->new_tab_start_time(); + MetricEventDurationDetails details(event_name, + static_cast<int>(duration.InMilliseconds())); + + if (event_name == "Tab.NewTabScriptStart") { + UMA_HISTOGRAM_TIMES("Tab.NewTabScriptStart", duration); + } else if (event_name == "Tab.NewTabDOMContentLoaded") { + UMA_HISTOGRAM_TIMES("Tab.NewTabDOMContentLoaded", duration); + } else if (event_name == "Tab.NewTabOnload") { + UMA_HISTOGRAM_TIMES("Tab.NewTabOnload", duration); + // The new tab page has finished loading; reset it. + tab->set_new_tab_start_time(base::TimeTicks()); + } else { + NOTREACHED(); + } + NotificationService::current()->Notify( + NotificationType::METRIC_EVENT_DURATION, + Source<TabContents>(tab), + Details<MetricEventDurationDetails>(&details)); } /////////////////////////////////////////////////////////////////////////////// |