summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 00:57:29 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 00:57:29 +0000
commit50e52cdb7b513558163b1d0285b4755dc697cd40 (patch)
tree2f72657bdeef16fff04e289798474ee8ae124774 /chrome
parent823821512bc23506c8d8b90651cfebe72d314d20 (diff)
downloadchromium_src-50e52cdb7b513558163b1d0285b4755dc697cd40.zip
chromium_src-50e52cdb7b513558163b1d0285b4755dc697cd40.tar.gz
chromium_src-50e52cdb7b513558163b1d0285b4755dc697cd40.tar.bz2
Add a ContentClient interface than an embedder of content has to implement. This allows us to move Chrome specific code out of content.
Review URL: http://codereview.chromium.org/6660011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/chrome_main.cc6
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/chrome_content_client.cc18
-rw-r--r--chrome/common/chrome_content_client.h25
-rw-r--r--chrome/gpu/gpu_thread.cc5
5 files changed, 54 insertions, 2 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 481941f..0156d2a 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/diagnostics/diagnostics_main.h"
#include "chrome/browser/platform_util.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
@@ -37,6 +38,7 @@
#include "chrome/common/set_process_title.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_process_host.h"
+#include "content/common/content_client.h"
#include "content/common/content_paths.h"
#include "ipc/ipc_switches.h"
#include "ui/base/resource/resource_bundle.h"
@@ -574,6 +576,10 @@ int ChromeMain(int argc, char** argv) {
Append(chrome::kHelperProcessExecutablePath));
#endif
+ // Initialize the content client which that code uses to talk to Chrome.
+ chrome::ChromeContentClient chrome_content_client;
+ content::SetContentClient(&chrome_content_client);
+
// Notice a user data directory override if any
FilePath user_data_dir =
command_line.GetSwitchValuePath(switches::kUserDataDir);
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index fa8295b..865b4e5 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -217,6 +217,8 @@
'common/automation_messages_internal.h',
'common/badge_util.cc',
'common/badge_util.h',
+ 'common/chrome_content_client.cc',
+ 'common/chrome_content_client.h',
'common/chrome_descriptors.h',
'common/chrome_plugin_api.h',
'common/chrome_plugin_lib.cc',
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
new file mode 100644
index 0000000..eeba233
--- /dev/null
+++ b/chrome/common/chrome_content_client.cc
@@ -0,0 +1,18 @@
+// 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 "chrome/common/chrome_content_client.h"
+
+#include "chrome/common/child_process_logging.h"
+
+namespace chrome {
+
+void ChromeContentClient::SetActiveURL(const GURL& url) {
+}
+
+void ChromeContentClient::SetGpuInfo(const GPUInfo& gpu_info) {
+ child_process_logging::SetGpuInfo(gpu_info);
+}
+
+} // namespace chrome
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
new file mode 100644
index 0000000..8c91fca
--- /dev/null
+++ b/chrome/common/chrome_content_client.h
@@ -0,0 +1,25 @@
+// 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_COMMON_CHROME_CONTENT_CLIENT_H_
+#define CHROME_COMMON_CHROME_CONTENT_CLIENT_H_
+#pragma once
+
+#include "content/common/content_client.h"
+
+namespace chrome {
+
+class ChromeContentClient : public content::ContentClient {
+ public:
+ // Sets the URL that is logged if the child process crashes. Use GURL() to
+ // clear the URL.
+ virtual void SetActiveURL(const GURL& url);
+
+ // Sets the data on the gpu to send along with crash reports.
+ virtual void SetGpuInfo(const GPUInfo& gpu_info);
+};
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_CHROME_CONTENT_CLIENT_H_
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index 96722bf..706d537 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -13,12 +13,12 @@
#include "base/command_line.h"
#include "base/threading/worker_pool.h"
#include "build/build_config.h"
-#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/gpu/gpu_info_collector.h"
#include "chrome/gpu/gpu_watchdog_thread.h"
#include "content/common/child_process.h"
+#include "content/common/content_client.h"
#include "ipc/ipc_channel_handle.h"
#if defined(OS_MACOSX)
@@ -134,7 +134,8 @@ void GpuThread::OnInitialize() {
gpu_info_.collection_error = true;
LOG(ERROR) << "gpu_info_collector::CollectGraphicsInfo() failed";
}
- child_process_logging::SetGpuInfo(gpu_info_);
+
+ content::GetContentClient()->SetGpuInfo(gpu_info_);
LOG(INFO) << "gpu_info_collector::CollectGraphicsInfo complete";
// Record initialization only after collecting the GPU info because that can