summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 17:25:03 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-01 17:25:03 +0000
commit54e0ee6965dfa922f931066cb4cd06ac15ae558e (patch)
tree4b4e2c3bce8cb9ca593b2ef46ade2b2440fe89d9 /chrome
parentda3c6219c84a56da815288bd36ef1a94382a81eb (diff)
downloadchromium_src-54e0ee6965dfa922f931066cb4cd06ac15ae558e.zip
chromium_src-54e0ee6965dfa922f931066cb4cd06ac15ae558e.tar.gz
chromium_src-54e0ee6965dfa922f931066cb4cd06ac15ae558e.tar.bz2
Move kChromeSearchScheme out of content since it's a chrome feature.
Also remove ContentBrowserClient::RenderProcessHostDeleted since it duplicates an existing notification. Review URL: https://codereview.chromium.org/12087129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_content_browser_client.cc12
-rw-r--r--chrome/browser/chrome_content_browser_client.h2
-rw-r--r--chrome/browser/instant/instant_service.cc18
-rw-r--r--chrome/browser/instant/instant_service.h12
-rw-r--r--chrome/common/chrome_content_client.cc1
-rw-r--r--chrome/common/url_constants.cc2
-rw-r--r--chrome/common/url_constants.h7
7 files changed, 30 insertions, 24 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index df0137d..21ed3e8 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -720,18 +720,6 @@ void ChromeContentBrowserClient::RenderProcessHostCreated(
host->Send(new ChromeViewMsg_SetContentSettingRules(rules));
}
-void ChromeContentBrowserClient::RenderProcessHostDeleted(
- content::RenderProcessHost* host) {
- Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
- if (!profile)
- return;
-
- InstantService* instant_service =
- InstantServiceFactory::GetForProfile(profile);
- if (instant_service)
- instant_service->RemoveInstantProcess(host->GetID());
-}
-
GURL ChromeContentBrowserClient::GetEffectiveURL(
content::BrowserContext* browser_context, const GURL& url) {
Profile* profile = Profile::FromBrowserContext(browser_context);
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 70f0a55..9f2ecc6 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -64,8 +64,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
content::WebContents* embedder_web_contents) OVERRIDE;
virtual void RenderProcessHostCreated(
content::RenderProcessHost* host) OVERRIDE;
- virtual void RenderProcessHostDeleted(
- content::RenderProcessHost* host) OVERRIDE;
virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) OVERRIDE;
virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
diff --git a/chrome/browser/instant/instant_service.cc b/chrome/browser/instant/instant_service.cc
index 1cb9074..a348233 100644
--- a/chrome/browser/instant/instant_service.cc
+++ b/chrome/browser/instant/instant_service.cc
@@ -4,7 +4,14 @@
#include "chrome/browser/instant/instant_service.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_process_host.h"
+
InstantService::InstantService() {
+ registrar_.Add(this,
+ content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
+ content::NotificationService::AllSources());
}
InstantService::~InstantService() {
@@ -14,10 +21,6 @@ void InstantService::AddInstantProcess(int process_id) {
process_ids_.insert(process_id);
}
-void InstantService::RemoveInstantProcess(int process_id) {
- process_ids_.erase(process_id);
-}
-
bool InstantService::IsInstantProcess(int process_id) const {
return process_ids_.count(process_id) != 0;
}
@@ -29,3 +32,10 @@ int InstantService::GetInstantProcessCount() const {
void InstantService::Shutdown() {
process_ids_.clear();
}
+
+void InstantService::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ int process_id = content::Source<content::RenderProcessHost>(source)->GetID();
+ process_ids_.erase(process_id);
+}
diff --git a/chrome/browser/instant/instant_service.h b/chrome/browser/instant/instant_service.h
index fd3a092..b3639fb 100644
--- a/chrome/browser/instant/instant_service.h
+++ b/chrome/browser/instant/instant_service.h
@@ -10,9 +10,12 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
// Tracks render process host ids that are associated with Instant.
-class InstantService : public ProfileKeyedService {
+class InstantService : public ProfileKeyedService,
+ public content::NotificationObserver {
public:
InstantService();
virtual ~InstantService();
@@ -20,7 +23,6 @@ class InstantService : public ProfileKeyedService {
// Add, remove, and query RenderProcessHost IDs that are associated with
// Instant processes.
void AddInstantProcess(int process_id);
- void RemoveInstantProcess(int process_id);
bool IsInstantProcess(int process_id) const;
// For testing.
@@ -30,9 +32,15 @@ class InstantService : public ProfileKeyedService {
// ProfileKeyedService:
virtual void Shutdown() OVERRIDE;
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
// The process ids associated with Instant processes.
std::set<int> process_ids_;
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(InstantService);
};
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 5c4afe6..709a93f 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -381,6 +381,7 @@ void ChromeContentClient::AddAdditionalSchemes(
savable_schemes->push_back(extensions::kExtensionScheme);
standard_schemes->push_back(kExtensionResourceScheme);
savable_schemes->push_back(kExtensionResourceScheme);
+ standard_schemes->push_back(chrome::kChromeSearchScheme);
#if defined(OS_CHROMEOS)
standard_schemes->push_back(kCrosScheme);
#endif
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 91354bf..799e847 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -508,6 +508,8 @@ const int kNumberOfChromeDebugURLs =
const char kExtensionResourceScheme[] = "chrome-extension-resource";
+const char kChromeSearchScheme[] = "chrome-search";
+
// Google SafeSearch query parameters.
const char kSafeSearchSafeParameter[] = "safe=active";
const char kSafeSearchSsuiParameter[] = "ssui=on";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 9755a77..d80fc5a 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -393,9 +393,7 @@ extern const char kSideloadWipeoutHelpURL[];
#if defined(OS_CHROMEOS)
// The URL for the "Learn more" link for natural scrolling on ChromeOS.
extern const char kNaturalScrollHelpURL[];
-#endif
-#if defined(OS_CHROMEOS)
// The URL for the Learn More page about enterprise enrolled devices.
extern const char kLearnMoreEnterpriseURL[];
#endif
@@ -407,11 +405,12 @@ extern const int kNumberOfChromeDebugURLs;
// Canonical schemes you can use as input to GURL.SchemeIs().
extern const char kExtensionResourceScheme[];
+extern const char kChromeSearchScheme[];
+
#if defined(OS_CHROMEOS)
+extern const char kCrosScheme[];
extern const char kDriveScheme[];
-#endif
-#if defined(OS_CHROMEOS)
// "Learn more" URL for the Cloud Print section under Options.
extern const char kCloudPrintLearnMoreURL[];
#endif