summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_content_browser_client.cc27
-rw-r--r--chrome/browser/chrome_content_browser_client.h3
-rw-r--r--chrome/browser/printing/print_preview_message_handler.cc2
-rw-r--r--chrome/browser/renderer_host/chrome_render_view_host_observer.cc1
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc2
-rw-r--r--chrome/browser/ui/browser.cc2
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc12
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.h6
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui.cc28
-rw-r--r--chrome/chrome_browser.gypi4
-rw-r--r--chrome/chrome_common.gypi1
-rw-r--r--content/browser/DEPS26
-rw-r--r--content/browser/browser_child_process_host.cc1
-rw-r--r--content/browser/clipboard_dispatcher.h (renamed from chrome/browser/clipboard_dispatcher.h)6
-rw-r--r--content/browser/clipboard_dispatcher_gtk.cc (renamed from chrome/browser/clipboard_dispatcher_mac.mm)4
-rw-r--r--content/browser/clipboard_dispatcher_mac.mm (renamed from chrome/browser/clipboard_dispatcher_gtk.cc)4
-rw-r--r--content/browser/clipboard_dispatcher_win.cc (renamed from chrome/browser/clipboard_dispatcher_win.cc)3
-rw-r--r--content/browser/content_browser_client.cc9
-rw-r--r--content/browser/content_browser_client.h10
-rw-r--r--content/browser/renderer_host/clipboard_message_filter.cc2
-rw-r--r--content/browser/renderer_host/render_view_host.h1
-rw-r--r--content/browser/renderer_host/render_view_host_delegate.h1
-rw-r--r--content/browser/tab_contents/background_contents.h185
-rw-r--r--content/browser/tab_contents/interstitial_page.cc1
-rw-r--r--content/browser/tab_contents/tab_contents.cc62
-rw-r--r--content/browser/tab_contents/tab_contents.h11
-rw-r--r--content/common/content_restriction.h (renamed from chrome/common/content_restriction.h)6
-rw-r--r--content/content_browser.gypi4
-rw-r--r--content/content_common.gypi1
29 files changed, 122 insertions, 303 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/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));
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8192940..c9d26f1 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -707,10 +707,6 @@
'browser/chromeos/wm_ipc.h',
'browser/chromeos/wm_message_listener.cc',
'browser/chromeos/wm_message_listener.h',
- 'browser/clipboard_dispatcher.h',
- 'browser/clipboard_dispatcher_gtk.cc',
- 'browser/clipboard_dispatcher_mac.mm',
- 'browser/clipboard_dispatcher_win.cc',
'browser/cocoa/authorization_util.h',
'browser/cocoa/authorization_util.mm',
'browser/cocoa/file_metadata.h',
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 38a28da..942d4ee 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -37,7 +37,6 @@
'common/child_process_logging_win.cc',
'common/chrome_version_info.cc',
'common/chrome_version_info.h',
- 'common/content_restriction.h',
'common/content_settings.cc',
'common/content_settings.h',
'common/content_settings_helper.cc',
diff --git a/content/browser/DEPS b/content/browser/DEPS
index eb3b4a8..3916230 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -4,9 +4,6 @@ include_rules = [
# Listing of the remaining #chrome includes in content\browser. People are
# actively working on reducing this to 0. Do not add anymore!
- # jam will move asap, this was forgotten
- "+chrome/browser/renderer_host/render_view_host_delegate.h",
-
# http://crbug.com/77093
"+chrome/app/breakpad_mac.h",
"+chrome/browser/crash_handler_host_linux.h",
@@ -16,8 +13,6 @@ include_rules = [
"+chrome/browser/automation/automation_resource_message_filter.h",
"+chrome/browser/automation/automation_resource_routing_delegate.h",
- "+chrome/browser/clipboard_dispatcher.h",
-
"+chrome/browser/browser_about_handler.h",
"+chrome/browser/browser_process.h",
@@ -26,8 +21,6 @@ include_rules = [
"+chrome/browser/browser_url_handler.h",
- "+chrome/browser/character_encoding.h",
-
# http://crbug.com/76793
"+chrome/browser/content_settings/content_settings_details.h",
"+chrome/browser/content_settings/host_content_settings_map.h",
@@ -44,8 +37,6 @@ include_rules = [
"+chrome/browser/defaults.h",
- "+chrome/browser/dom_operation_notification_details.h",
-
"+chrome/browser/download/download_file_manager.h",
"+chrome/browser/download/download_item_model.h",
"+chrome/browser/download/download_manager.h",
@@ -66,8 +57,6 @@ include_rules = [
"+chrome/browser/favicon/favicon_tab_helper.h",
"+chrome/browser/favicon/favicon_service.h",
- "+chrome/browser/google/google_util.h",
-
# http://crbug.com/76794
"+chrome/browser/history/history.h",
"+chrome/browser/history/history_types.h",
@@ -79,8 +68,6 @@ include_rules = [
"+chrome/browser/mach_broker_mac.h",
- "+chrome/browser/metrics/metric_event_duration_details.h",
-
"+chrome/browser/net/load_timing_observer.h",
"+chrome/browser/net/predictor_api.h",
"+chrome/browser/net/resolve_proxy_msg_helper.h",
@@ -90,10 +77,6 @@ include_rules = [
"+chrome/browser/notifications/desktop_notification_service_factory.h",
"+chrome/browser/notifications/notifications_prefs_cache.h",
- "+chrome/browser/omnibox_search_hint.h",
-
- "+chrome/browser/pdf_unsupported_feature.h",
-
"+chrome/browser/platform_util.h",
"+chrome/browser/plugin_download_helper.h",
@@ -164,8 +147,6 @@ include_rules = [
"+chrome/common/render_messages.h",
"+chrome/common/url_constants.h",
- "+chrome/common/content_restriction.h",
-
"+chrome/common/icon_messages.h",
# http://crbug.com/77091
@@ -179,17 +160,10 @@ include_rules = [
"+chrome/common/security_style.h",
- # http://crbug.com/77088
- "+chrome/common/translate_errors.h",
-
"+chrome/common/view_types.h",
- "+chrome/common/window_container_type.h",
-
"+chrome/common/net/x509_certificate_model.h",
- "+chrome/installer/util/google_update_settings.h",
-
# ONLY USED BY TESTS
"+chrome/browser/chromeos/cros/mock_network_library.h",
"+chrome/browser/net/url_request_failed_dns_job.h",
diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc
index 43759e1..e6375f0 100644
--- a/content/browser/browser_child_process_host.cc
+++ b/content/browser/browser_child_process_host.cc
@@ -18,7 +18,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/resource_message_filter.h"
#include "content/browser/trace_message_filter.h"
diff --git a/chrome/browser/clipboard_dispatcher.h b/content/browser/clipboard_dispatcher.h
index 3ca3281..7b62d0c 100644
--- a/chrome/browser/clipboard_dispatcher.h
+++ b/content/browser/clipboard_dispatcher.h
@@ -2,8 +2,8 @@
// 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_
+#ifndef CONTENT_BROWSER_CLIPBOARD_DISPATCHER_H_
+#define CONTENT_BROWSER_CLIPBOARD_DISPATCHER_H_
#pragma once
#include <vector>
@@ -38,4 +38,4 @@ class ClipboardDispatcher {
DISALLOW_COPY_AND_ASSIGN(ClipboardDispatcher);
};
-#endif // CHROME_BROWSER_CLIPBOARD_DISPATCHER_H_
+#endif // CONTENT_BROWSER_CLIPBOARD_DISPATCHER_H_
diff --git a/chrome/browser/clipboard_dispatcher_mac.mm b/content/browser/clipboard_dispatcher_gtk.cc
index e91f452..88b57fe 100644
--- a/chrome/browser/clipboard_dispatcher_mac.mm
+++ b/content/browser/clipboard_dispatcher_gtk.cc
@@ -2,7 +2,8 @@
// 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 "content/browser/clipboard_dispatcher.h"
+
#include "base/logging.h"
bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer,
@@ -30,4 +31,3 @@ bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer,
filenames->clear();
return false;
}
-
diff --git a/chrome/browser/clipboard_dispatcher_gtk.cc b/content/browser/clipboard_dispatcher_mac.mm
index f5a456f..cfc4f93 100644
--- a/chrome/browser/clipboard_dispatcher_gtk.cc
+++ b/content/browser/clipboard_dispatcher_mac.mm
@@ -2,7 +2,8 @@
// 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 "content/browser/clipboard_dispatcher.h"
+
#include "base/logging.h"
bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer,
@@ -30,3 +31,4 @@ bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer,
filenames->clear();
return false;
}
+
diff --git a/chrome/browser/clipboard_dispatcher_win.cc b/content/browser/clipboard_dispatcher_win.cc
index f5a456f..88b57fe 100644
--- a/chrome/browser/clipboard_dispatcher_win.cc
+++ b/content/browser/clipboard_dispatcher_win.cc
@@ -2,7 +2,8 @@
// 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 "content/browser/clipboard_dispatcher.h"
+
#include "base/logging.h"
bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer,
diff --git a/content/browser/content_browser_client.cc b/content/browser/content_browser_client.cc
index c02c95c..c444733 100644
--- a/content/browser/content_browser_client.cc
+++ b/content/browser/content_browser_client.cc
@@ -31,4 +31,13 @@ GURL ContentBrowserClient::GetEffectiveURL(Profile* profile, const GURL& url) {
return url;
}
+GURL ContentBrowserClient::GetAlternateErrorPageURL(const TabContents* tab) {
+ return GURL();
+}
+
+std::string ContentBrowserClient::GetCanonicalEncodingNameByAliasName(
+ const std::string& alias_name) {
+ return alias_name;
+}
+
} // namespace content
diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h
index bcb2d15..49a2bbf 100644
--- a/content/browser/content_browser_client.h
+++ b/content/browser/content_browser_client.h
@@ -6,12 +6,15 @@
#define CONTENT_BROWSER_CONTENT_BROWSER_CLIENT_H_
#pragma once
+#include <string>
+
#include "content/common/content_client.h"
class BrowserRenderProcessHost;
class GURL;
class Profile;
class RenderViewHost;
+class TabContents;
namespace content {
@@ -37,6 +40,13 @@ class ContentBrowserClient {
// Get the effective URL for the given actual URL, to allow an embedder to
// group different url schemes in the same SiteInstance.
virtual GURL GetEffectiveURL(Profile* profile, const GURL& url);
+
+ // See RenderViewHostDelegate's comment.
+ virtual GURL GetAlternateErrorPageURL(const TabContents* tab);
+
+ // See CharacterEncoding's comment.
+ virtual std::string GetCanonicalEncodingNameByAliasName(
+ const std::string& alias_name);
};
} // namespace content
diff --git a/content/browser/renderer_host/clipboard_message_filter.cc b/content/browser/renderer_host/clipboard_message_filter.cc
index c69691a..b1656b0 100644
--- a/content/browser/renderer_host/clipboard_message_filter.cc
+++ b/content/browser/renderer_host/clipboard_message_filter.cc
@@ -12,7 +12,7 @@
#include "base/stl_util-inl.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/clipboard_dispatcher.h"
+#include "content/browser/clipboard_dispatcher.h"
#include "content/common/clipboard_messages.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index 904fe4c..14ecddd 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/render_view_commands.h"
-#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/common/page_zoom.h"
diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h
index dc9d120..be5d687 100644
--- a/content/browser/renderer_host/render_view_host_delegate.h
+++ b/content/browser/renderer_host/render_view_host_delegate.h
@@ -14,7 +14,6 @@
#include "base/process_util.h"
#include "base/string16.h"
#include "chrome/common/content_settings_types.h"
-#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "content/common/dom_storage_common.h"
#include "content/common/window_container_type.h"
diff --git a/content/browser/tab_contents/background_contents.h b/content/browser/tab_contents/background_contents.h
deleted file mode 100644
index ef03cd4..0000000
--- a/content/browser/tab_contents/background_contents.h
+++ /dev/null
@@ -1,185 +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 CONTENT_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
-#define CONTENT_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
-#pragma once
-
-#include <string>
-#include <vector>
-
-#include "chrome/browser/renderer_host/render_view_host_delegate.h"
-#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
-#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
-#include "chrome/common/view_types.h"
-#include "chrome/common/window_container_type.h"
-#include "content/common/notification_registrar.h"
-#include "webkit/glue/window_open_disposition.h"
-
-class TabContents;
-struct WebPreferences;
-class DesktopNotificationHandler;
-
-namespace gfx {
-class Rect;
-}
-
-// This class is a peer of TabContents. It can host a renderer, but does not
-// have any visible display. Its navigation is not managed by a
-// NavigationController because is has no facility for navigating (other than
-// programatically view window.location.href) or RenderViewHostManager because
-// it is never allowed to navigate across a SiteInstance boundary.
-class BackgroundContents : public RenderViewHostDelegate,
- public RenderViewHostDelegate::View,
- public NotificationObserver,
- public JavaScriptAppModalDialogDelegate {
- public:
- class Delegate {
- public:
- // Called by ShowCreatedWindow. Asks the delegate to attach the opened
- // TabContents to a suitable container (e.g. browser) or to show it if it's
- // a popup window.
- virtual void AddTabContents(TabContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture) = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- BackgroundContents(SiteInstance* site_instance,
- int routing_id,
- Delegate* delegate);
- virtual ~BackgroundContents();
-
- // Provide access to the RenderViewHost for the
- // RenderViewHostDelegateViewHelper
- RenderViewHost* render_view_host() { return render_view_host_; }
-
- // RenderViewHostDelegate implementation.
- virtual BackgroundContents* GetAsBackgroundContents();
- virtual RenderViewHostDelegate::View* GetViewDelegate();
- virtual const GURL& GetURL() const;
- virtual ViewType::Type GetRenderViewType() const;
- virtual int GetBrowserWindowID() const;
- virtual void DidNavigate(RenderViewHost* render_view_host,
- const ViewHostMsg_FrameNavigate_Params& params);
- virtual WebPreferences GetWebkitPrefs();
- virtual void RunJavaScriptMessage(const std::wstring& message,
- const std::wstring& default_prompt,
- const GURL& frame_url,
- const int flags,
- IPC::Message* reply_msg,
- bool* did_suppress_message);
- virtual void Close(RenderViewHost* render_view_host);
- virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
- virtual void RenderViewGone(RenderViewHost* rvh,
- base::TerminationStatus status,
- int error_code);
- virtual bool OnMessageReceived(const IPC::Message& message);
-
- // RenderViewHostDelegate::View
- virtual void CreateNewWindow(
- int route_id,
- const ViewHostMsg_CreateWindow_Params& params);
- virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type);
- virtual void CreateNewFullscreenWidget(int route_id);
- virtual void ShowCreatedWindow(int route_id,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture);
- virtual void ShowCreatedWidget(int route_id,
- const gfx::Rect& initial_pos);
- virtual void ShowCreatedFullscreenWidget(int route_id);
- virtual void ShowContextMenu(const ContextMenuParams& params) {}
- virtual void ShowPopupMenu(const gfx::Rect& bounds,
- int item_height,
- double item_font_size,
- int selected_item,
- const std::vector<WebMenuItem>& items,
- bool right_aligned) {}
- virtual void StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_operations,
- const SkBitmap& image,
- const gfx::Point& image_offset) {}
- virtual void UpdateDragCursor(WebKit::WebDragOperation operation) {}
- virtual void GotFocus() {}
- virtual void TakeFocus(bool reverse) {}
- virtual void LostCapture() {}
- virtual void Activate() {}
- virtual void Deactivate() {}
- virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut);
- virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
- virtual void HandleMouseMove() {}
- virtual void HandleMouseDown() {}
- virtual void HandleMouseLeave() {}
- virtual void HandleMouseUp() {}
- virtual void HandleMouseActivate() {}
- virtual void UpdatePreferredSize(const gfx::Size& new_size) {}
-
- // NotificationObserver
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- // Overridden from JavaScriptAppModalDialogDelegate:
- virtual void OnMessageBoxClosed(IPC::Message* reply_msg,
- bool success,
- const std::wstring& prompt);
- virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {}
- virtual gfx::NativeWindow GetMessageBoxRootWindow();
- virtual TabContents* AsTabContents();
- virtual ExtensionHost* AsExtensionHost();
-
- virtual void UpdateInspectorSetting(const std::string& key,
- const std::string& value);
- virtual void ClearInspectorSettings();
-
- // Helper to find the BackgroundContents that originated the given request.
- // Can be NULL if the page has been closed or some other error occurs.
- // Should only be called from the UI thread, since it accesses
- // BackgroundContents.
- static BackgroundContents* GetBackgroundContentsByID(int render_process_id,
- int render_view_id);
-
- protected:
- // Exposed for testing.
- BackgroundContents();
-
- private:
- // The delegate for this BackgroundContents.
- Delegate* delegate_;
-
- // The host for our HTML content.
- RenderViewHost* render_view_host_;
-
- // Common implementations of some RenderViewHostDelegate::View methods.
- RenderViewHostDelegateViewHelper delegate_view_helper_;
-
- // The URL being hosted.
- GURL url_;
-
- NotificationRegistrar registrar_;
-
- // Handles desktop notification IPCs.
- scoped_ptr<DesktopNotificationHandler> desktop_notification_handler_;
-
- DISALLOW_COPY_AND_ASSIGN(BackgroundContents);
-};
-
-// This is the data sent out as the details with BACKGROUND_CONTENTS_OPENED.
-struct BackgroundContentsOpenedDetails {
- // The BackgroundContents object that has just been opened.
- BackgroundContents* contents;
-
- // The name of the parent frame for these contents.
- const string16& frame_name;
-
- // The ID of the parent application (if any).
- const string16& application_id;
-};
-
-#endif // CONTENT_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_
diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc
index da0b968..c764621 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -12,7 +12,6 @@
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/ui/browser_list.h"
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 00a58c3..ebb7461 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -15,27 +15,21 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/character_encoding.h"
#include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/defaults.h"
-#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/external_protocol_handler.h"
#include "chrome/browser/favicon/favicon_service.h"
-#include "chrome/browser/google/google_util.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/load_notification_details.h"
-#include "chrome/browser/metrics/metric_event_duration_details.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
-#include "chrome/browser/omnibox_search_hint.h"
-#include "chrome/browser/pdf_unsupported_feature.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/plugin_observer.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -50,7 +44,6 @@
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/content_restriction.h"
#include "chrome/common/icon_messages.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
@@ -74,6 +67,7 @@
#include "content/browser/webui/web_ui_factory.h"
#include "content/common/bindings_policy.h"
#include "content/common/content_client.h"
+#include "content/common/content_restriction.h"
#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
@@ -289,10 +283,6 @@ TabContents::TabContents(Profile* profile,
registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED,
NotificationService::AllSources());
- // Set-up the showing of the omnibox search infobar if applicable.
- if (OmniboxSearchHint::IsEnabled(profile))
- omnibox_search_hint_.reset(new OmniboxSearchHint(this));
-
// Can only add observers after render_manager_.Init() is called, since that's
// what sets up the render_view_host which TabContentObserver's constructor
// uses to get the routing_id.
@@ -394,8 +384,6 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions,
OnUpdateContentRestrictions)
- IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature,
- OnPDFHasUnsupportedFeature)
IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -1014,33 +1002,6 @@ void TabContents::WindowMoveOrResizeStarted() {
render_view_host()->WindowMoveOrResizeStarted();
}
-void TabContents::LogNewTabTime(const std::string& event_name) {
- // Not all new tab pages get timed. In those cases, we don't have a
- // new_tab_start_time_.
- if (new_tab_start_time_.is_null())
- return;
-
- base::TimeDelta duration = base::TimeTicks::Now() - 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.
- new_tab_start_time_ = base::TimeTicks();
- } else {
- NOTREACHED();
- }
- NotificationService::current()->Notify(
- NotificationType::METRIC_EVENT_DURATION,
- Source<TabContents>(this),
- Details<MetricEventDurationDetails>(&details));
-}
-
void TabContents::OnCloseStarted() {
if (tab_close_start_time_.is_null())
tab_close_start_time_ = base::TimeTicks::Now();
@@ -1297,10 +1258,6 @@ void TabContents::OnUpdateContentRestrictions(int restrictions) {
SetContentRestrictions(restrictions);
}
-void TabContents::OnPDFHasUnsupportedFeature() {
- PDFHasUnsupportedFeature(this);
-}
-
// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading and calls the base implementation.
void TabContents::SetIsLoading(bool is_loading,
@@ -2076,19 +2033,7 @@ void TabContents::RunBeforeUnloadConfirm(const std::wstring& message,
}
GURL TabContents::GetAlternateErrorPageURL() const {
- GURL url;
- // Disable alternate error pages when in OffTheRecord/Incognito mode.
- if (profile()->IsOffTheRecord())
- return url;
-
- PrefService* prefs = profile()->GetPrefs();
- DCHECK(prefs);
- if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
- url = google_util::AppendGoogleLocaleParam(
- GURL(google_util::kLinkDoctorBaseURL));
- url = google_util::AppendGoogleTLDParam(url);
- }
- return url;
+ return content::GetContentClient()->browser()->GetAlternateErrorPageURL(this);
}
WebPreferences TabContents::GetWebkitPrefs() {
@@ -2392,7 +2337,8 @@ ExtensionHost* TabContents::AsExtensionHost() {
}
void TabContents::set_encoding(const std::string& encoding) {
- encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
+ encoding_ = content::GetContentClient()->browser()->
+ GetCanonicalEncodingNameByAliasName(encoding);
}
void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) {
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 5fe5e97..3eb3012 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -60,7 +60,6 @@ class DownloadItem;
class Extension;
class InfoBarDelegate;
class LoadNotificationDetails;
-class OmniboxSearchHint;
class PluginObserver;
class Profile;
class RenderViewHost;
@@ -503,15 +502,12 @@ class TabContents : public PageNavigator,
opener_web_ui_type_ = opener_web_ui_type;
}
- // We want to time how long it takes to create a new tab page. This method
- // gets called as parts of the new tab page have loaded.
- void LogNewTabTime(const std::string& event_name);
-
// Set the time when we started to create the new tab page. This time is
// from before we created this TabContents.
void set_new_tab_start_time(const base::TimeTicks& time) {
new_tab_start_time_ = time;
}
+ base::TimeTicks new_tab_start_time() const { return new_tab_start_time_; }
// Notification that tab closing has started. This can be called multiple
// times, subsequent calls are ignored.
@@ -667,7 +663,6 @@ class TabContents : public PageNavigator,
void OnDocumentLoadedInFrame(int64 frame_id);
void OnDidFinishLoad(int64 frame_id);
void OnUpdateContentRestrictions(int restrictions);
- void OnPDFHasUnsupportedFeature();
void OnGoToEntryAtOffset(int offset);
@@ -1013,10 +1008,6 @@ class TabContents : public PageNavigator,
// turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
bool is_showing_before_unload_dialog_;
- // 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_;
-
// Settings that get passed to the renderer process.
RendererPreferences renderer_preferences_;
diff --git a/chrome/common/content_restriction.h b/content/common/content_restriction.h
index 52ea5c5..1497939 100644
--- a/chrome/common/content_restriction.h
+++ b/content/common/content_restriction.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_CONTENT_RESTRICTION_H_
-#define CHROME_COMMON_CONTENT_RESTRICTION_H_
+#ifndef CONTENT_COMMON_CONTENT_RESTRICTION_H_
+#define CONTENT_COMMON_CONTENT_RESTRICTION_H_
#pragma once
// Used by a full-page plugin to disable browser commands because of
@@ -16,4 +16,4 @@ enum ContentRestriction {
CONTENT_RESTRICTION_SAVE = 1 << 4
};
-#endif // CHROME_COMMON_CONTENT_RESTRICTION_H_
+#endif // CONTENT_COMMON_CONTENT_RESTRICTION_H_
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 53129ff..7738ccc 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -52,6 +52,10 @@
'browser/child_process_security_policy.h',
'browser/chrome_blob_storage_context.cc',
'browser/chrome_blob_storage_context.h',
+ 'browser/clipboard_dispatcher.h',
+ 'browser/clipboard_dispatcher_gtk.cc',
+ 'browser/clipboard_dispatcher_mac.mm',
+ 'browser/clipboard_dispatcher_win.cc',
'browser/content_browser_client.cc',
'browser/content_browser_client.h',
'browser/cross_site_request_manager.cc',
diff --git a/content/content_common.gypi b/content/content_common.gypi
index b2e442e..998641c 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -62,6 +62,7 @@
'common/content_counters.h',
'common/content_paths.cc',
'common/content_paths.h',
+ 'common/content_restriction.h',
'common/content_switches.cc',
'common/content_switches.h',
'common/css_colors.h',