diff options
Diffstat (limited to 'chrome')
19 files changed, 265 insertions, 44 deletions
diff --git a/chrome/browser/automation/url_request_mock_http_job.cc b/chrome/browser/automation/url_request_mock_http_job.cc index 9f2ccfc..ed384e6 100644 --- a/chrome/browser/automation/url_request_mock_http_job.cc +++ b/chrome/browser/automation/url_request_mock_http_job.cc @@ -33,9 +33,8 @@ URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request, // Convert the file:/// URL to a path on disk. std::wstring file_path; net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); - URLRequestMockHTTPJob* job = new URLRequestMockHTTPJob(request); - job->file_path_ = FilePath::FromWStringHack(file_path); - return job; + return new URLRequestMockHTTPJob(request, + FilePath::FromWStringHack(file_path)); } /* static */ @@ -57,8 +56,9 @@ GURL URLRequestMockHTTPJob::GetMockUrl(const std::wstring& path) { return GURL(url); } -URLRequestMockHTTPJob::URLRequestMockHTTPJob(URLRequest* request) - : URLRequestFileJob(request) { } +URLRequestMockHTTPJob::URLRequestMockHTTPJob(URLRequest* request, + const FilePath& file_path) + : URLRequestFileJob(request, file_path) { } void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) { std::wstring header_file = file_path_.ToWStringHack() + kMockHeaderFileSuffix; diff --git a/chrome/browser/automation/url_request_mock_http_job.h b/chrome/browser/automation/url_request_mock_http_job.h index 2f34397..2772f1b 100644 --- a/chrome/browser/automation/url_request_mock_http_job.h +++ b/chrome/browser/automation/url_request_mock_http_job.h @@ -11,7 +11,7 @@ class URLRequestMockHTTPJob : public URLRequestFileJob { public: - URLRequestMockHTTPJob(URLRequest* request); + URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); virtual ~URLRequestMockHTTPJob() { } virtual bool GetMimeType(std::string* mime_type); diff --git a/chrome/browser/automation/url_request_mock_net_error_job.cc b/chrome/browser/automation/url_request_mock_net_error_job.cc index 1c67d29..c6bfa80 100644 --- a/chrome/browser/automation/url_request_mock_net_error_job.cc +++ b/chrome/browser/automation/url_request_mock_net_error_job.cc @@ -46,26 +46,25 @@ URLRequestJob* URLRequestMockNetErrorJob::Factory(URLRequest* request, DCHECK(iter != url_mock_info_map_.end()); MockInfo mock_info = iter->second; - URLRequestMockNetErrorJob* job = - new URLRequestMockNetErrorJob(request, mock_info.errors, - mock_info.ssl_cert); - // URLRequestMockNetErrorJob derives from URLRequestFileJob. We set the - // file_path_ of the job so that the URLRequestFileJob methods will do the - // loading from the files. + // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a + // FilePath so that the URLRequestFileJob methods will do the loading from + // the files. std::wstring file_url(L"file:///"); file_url.append(mock_info.base); file_url.append(UTF8ToWide(url.path())); // Convert the file:/// URL to a path on disk. std::wstring file_path; net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); - job->file_path_ = FilePath::FromWStringHack(file_path); - return job; + return new URLRequestMockNetErrorJob(request, mock_info.errors, + mock_info.ssl_cert, + FilePath::FromWStringHack(file_path)); } URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, - const std::vector<int>& errors, net::X509Certificate* cert) - : URLRequestMockHTTPJob(request), + const std::vector<int>& errors, net::X509Certificate* cert, + const FilePath& file_path) + : URLRequestMockHTTPJob(request, file_path), errors_(errors), ssl_cert_(cert) { } diff --git a/chrome/browser/automation/url_request_mock_net_error_job.h b/chrome/browser/automation/url_request_mock_net_error_job.h index 57aeedd..2f4d9f7 100644 --- a/chrome/browser/automation/url_request_mock_net_error_job.h +++ b/chrome/browser/automation/url_request_mock_net_error_job.h @@ -16,7 +16,8 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { public: URLRequestMockNetErrorJob(URLRequest* request, const std::vector<int>& errors, - net::X509Certificate* ssl_cert); + net::X509Certificate* ssl_cert, + const FilePath& file_path); virtual ~URLRequestMockNetErrorJob(); virtual void Start(); diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 82d35de..644f7b0 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -2246,6 +2246,14 @@ > </File> <File + RelativePath=".\extensions\extension_protocol.cc" + > + </File> + <File + RelativePath=".\extensions\extension_protocol.h" + > + </File> + <File RelativePath=".\extensions\extensions_service.cc" > </File> diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index a820e1f..4bea540 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -42,6 +42,7 @@ #include "chrome/browser/browser_trial.h" #include "chrome/browser/cert_store.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" +#include "chrome/browser/extensions/extension_protocol.h" #include "chrome/browser/first_run.h" #include "chrome/browser/jankometer.h" #include "chrome/browser/metrics_service.h" @@ -401,8 +402,10 @@ int BrowserMain(CommandLine &parsed_command_line, // Config the network module so it has access to resources. net::NetModule::SetResourceProvider(NetResourceProvider); - // Register our global network handler for chrome:// URLs. + // Register our global network handler for chrome:// and chrome-extension:// + // URLs. RegisterURLRequestChromeJob(); + RegisterExtensionProtocol(); browser_process->InitBrokerServices(broker_services); diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index 623ad8d..940ed68 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -83,7 +83,7 @@ class URLRequestChromeJob : public URLRequestJob { // URLRequestChromeFileJob is a URLRequestJob that acts like a file:// URL class URLRequestChromeFileJob : public URLRequestFileJob { public: - URLRequestChromeFileJob(URLRequest* request, const std::wstring& path); + URLRequestChromeFileJob(URLRequest* request, const FilePath& path); virtual ~URLRequestChromeFileJob(); private: @@ -244,7 +244,8 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, // Try first with a file handler std::wstring path; if (ChromeURLDataManager::URLToFilePath(request->url(), &path)) - return new URLRequestChromeFileJob(request, path); + return new URLRequestChromeFileJob(request, + FilePath::FromWStringHack(path)); // Fall back to using a custom handler return new URLRequestChromeJob(request); @@ -329,10 +330,8 @@ void URLRequestChromeJob::StartAsync() { } URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, - const std::wstring& path) - : URLRequestFileJob(request) { - // set URLRequestFileJob::file_path_ - this->file_path_ = FilePath::FromWStringHack(path); + const FilePath& path) + : URLRequestFileJob(request, path) { } URLRequestChromeFileJob::~URLRequestChromeFileJob() { } diff --git a/chrome/browser/extensions/extension.h b/chrome/browser/extensions/extension.h index 691a0b7..ac6c671 100644 --- a/chrome/browser/extensions/extension.h +++ b/chrome/browser/extensions/extension.h @@ -16,6 +16,7 @@ class Extension { public: Extension(){}; + Extension(const FilePath& path) : path_(path) {}; // The format for extension manifests that this code understands. static const int kExpectedFormatVersion = 1; @@ -39,6 +40,9 @@ class Extension { static const char* kInvalidContentScriptsListError; static const char* kInvalidContentScriptError; + // The path to the folder the extension is stored in. + const FilePath& path() const { return path_; } + // A human-readable ID for the extension. The convention is to use something // like 'com.example.myextension', but this is not currently enforced. An // extension's ID is used in things like directory structures and URLs, and @@ -65,9 +69,19 @@ class Extension { void CopyToValue(DictionaryValue* value); private: + // The path to the directory the extension is stored in. + FilePath path_; + + // The extension's ID. std::string id_; + + // The extension's human-readable name. std::string name_; + + // An optional description for the extension. std::string description_; + + // Paths to the content scripts the extension contains. std::vector<std::string> content_scripts_; DISALLOW_COPY_AND_ASSIGN(Extension); diff --git a/chrome/browser/extensions/extension_protocol.cc b/chrome/browser/extensions/extension_protocol.cc new file mode 100644 index 0000000..cb1ee09 --- /dev/null +++ b/chrome/browser/extensions/extension_protocol.cc @@ -0,0 +1,78 @@ +// Copyright (c) 2006-2008 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/extensions/extension_protocol.h" + +#include "base/string_util.h" +#include "chrome/browser/net/chrome_url_request_context.h" +#include "googleurl/src/url_util.h" +#include "net/base/net_util.h" +#include "net/url_request/url_request_file_job.h" + +static const char kExtensionURLScheme[] = "chrome-extension"; + +FilePath GetPathForExtensionResource(const FilePath& extension_path, + const std::string& url_path) { + DCHECK(extension_path.IsAbsolute()); + DCHECK(url_path.length() > 0 && url_path[0] == '/'); + + // Build up a file:// URL and convert that back to a FilePath. This avoids + // URL encoding and path separator issues. + + // Convert the extension's root to a file:// URL. + GURL extension_url = net::FilePathToFileURL(extension_path); + if (!extension_url.is_valid()) + return FilePath(); + + // Append the requested path. + GURL::Replacements replacements; + std::string new_path(extension_url.path()); + new_path += url_path; + replacements.SetPathStr(new_path); + GURL file_url = extension_url.ReplaceComponents(replacements); + if (!file_url.is_valid()) + return FilePath(); + + // Convert the result back to a FilePath. + FilePath ret_val; + if (!net::FileURLToFilePath(file_url, &ret_val)) + return FilePath(); + + if (!file_util::AbsolutePath(&ret_val)) + return FilePath(); + + // Double-check that the path we ended up with is actually inside the + // extension root. + if (!extension_path.Contains(ret_val)) + return FilePath(); + + return ret_val; +} + +// Creates a URLRequestJob instance for an extension URL. This is the factory +// function that is registered with URLRequest. +static URLRequestJob* CreateURLRequestJob(URLRequest* request, + const std::string& scheme) { + ChromeURLRequestContext* context = + static_cast<ChromeURLRequestContext*>(request->context()); + + FilePath extension_path = context->GetPathForExtension(request->url().host()); + if (extension_path.value().empty()) + return NULL; + + FilePath path = GetPathForExtensionResource(extension_path, + request->url().path()); + if (path.value().empty()) + return NULL; + + return new URLRequestFileJob(request, path); +} + +void RegisterExtensionProtocol() { + // Being a standard scheme allows us to resolve relative paths + url_util::AddStandardScheme(kExtensionURLScheme); + + URLRequest::RegisterProtocolFactory(kExtensionURLScheme, + &CreateURLRequestJob); +} diff --git a/chrome/browser/extensions/extension_protocol.h b/chrome/browser/extensions/extension_protocol.h new file mode 100644 index 0000000..54254db --- /dev/null +++ b/chrome/browser/extensions/extension_protocol.h @@ -0,0 +1,14 @@ +// Copyright (c) 2006-2008 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/file_path.h" + +// Gets a FilePath for a resource inside an extension. |extension_path| is the +// full path to the extension directory. |resource_path| is the path to the +// resource from the extension root, including the leading '/'. +FilePath GetPathForExtensionResource(const FilePath& extension_path, + const std::string& resource_path); + +// Registers support for the extension URL scheme. +void RegisterExtensionProtocol(); diff --git a/chrome/browser/extensions/extension_protocol_unittest.cc b/chrome/browser/extensions/extension_protocol_unittest.cc new file mode 100644 index 0000000..1d2b4f2 --- /dev/null +++ b/chrome/browser/extensions/extension_protocol_unittest.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2006-2008 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/extensions/extension_protocol.h" +#include "testing/gtest/include/gtest/gtest.h" + +class ExtensionProtocolTest : public testing::Test { +}; + +TEST(ExtensionProtocolTest, GetPathForExtensionResource) { +#if defined(OS_WIN) + FilePath extension_path(FILE_PATH_LITERAL("C:\\myextension")); + EXPECT_EQ(std::wstring(L"C:\\myextension\\foo\\bar.gif"), + GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()); + EXPECT_EQ(std::wstring(L"C:\\myextension\\"), + GetPathForExtensionResource(extension_path, "/").value()); + // TODO(aa): This one is a bit weird, but is what net::FileURLToFilePath() + // returns for this input. Investigate adding more validation. + EXPECT_EQ(std::wstring(L"C:\\myextension\\c:\\foo.gif"), + GetPathForExtensionResource(extension_path, "/c:/foo.gif").value()); + EXPECT_EQ(std::wstring(L"C:\\myextension\\foo.gif"), + GetPathForExtensionResource(extension_path, "//foo.gif").value()); + EXPECT_EQ(std::wstring(L""), + GetPathForExtensionResource(extension_path, "/../foo.gif").value()); +#else + FilePath extension_path(FILE_PATH_LITERAL("/myextension")); + EXPECT_EQ(std::wstring("/myextension/foo/bar.gif"), + GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()); + EXPECT_EQ(std::wstring("/myextension/"), + GetPathForExtensionResource(extension_path, "/").value()); + EXPECT_EQ(std::wstring("/myextension/foo.gif"), + GetPathForExtensionResource(extension_path, "//foo.gif").value()); + EXPECT_EQ(std::wstring(""), + GetPathForExtensionResource(extension_path, "/../foo.gif").value()); +#endif + + +} diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 0245ce6..cd0397c 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -10,6 +10,7 @@ #include "base/thread.h" #include "chrome/browser/browser_process.h" #include "chrome/common/json_value_serializer.h" +#include "chrome/common/notification_service.h" // ExtensionsService @@ -51,9 +52,12 @@ void ExtensionsService::OnExtensionsLoadedFromDirectory( ExtensionList* new_extensions) { extensions_.insert(extensions_.end(), new_extensions->begin(), new_extensions->end()); - delete new_extensions; - // TODO(aa): Notify extensions are loaded. + NotificationService::current()->Notify(NOTIFY_EXTENSIONS_LOADED, + NotificationService::AllSources(), + Details<ExtensionList>(new_extensions)); + + delete new_extensions; } void ExtensionsService::OnExtensionLoadError(const std::string& error) { @@ -99,7 +103,7 @@ bool ExtensionsServiceBackend::LoadExtensionsFromDirectory( continue; } - scoped_ptr<Extension> extension(new Extension()); + scoped_ptr<Extension> extension(new Extension(child_path)); if (!extension->InitFromValue(*static_cast<DictionaryValue*>(root), &error)) { ReportExtensionLoadError(frontend.get(), child_path.ToWStringHack(), diff --git a/chrome/browser/greasemonkey_master.cc b/chrome/browser/greasemonkey_master.cc index 560f695..11c3085 100644 --- a/chrome/browser/greasemonkey_master.cc +++ b/chrome/browser/greasemonkey_master.cc @@ -195,7 +195,7 @@ void GreasemonkeyMaster::NewScriptsAvailable(base::SharedMemory* handle) { // We've got scripts ready to go. shared_memory_.swap(handle_deleter); - NotificationService::current()->Notify(NOTIFY_NEW_USER_SCRIPTS, + NotificationService::current()->Notify(NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, NotificationService::AllSources(), Details<base::SharedMemory>(handle)); } diff --git a/chrome/browser/greasemonkey_master_unittest.cc b/chrome/browser/greasemonkey_master_unittest.cc index 17924b5..4ce63a0 100644 --- a/chrome/browser/greasemonkey_master_unittest.cc +++ b/chrome/browser/greasemonkey_master_unittest.cc @@ -34,13 +34,13 @@ class GreasemonkeyMasterTest : public testing::Test, // Register for all user script notifications. NotificationService::current()->AddObserver(this, - NOTIFY_NEW_USER_SCRIPTS, + NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, NotificationService::AllSources()); } virtual void TearDown() { NotificationService::current()->RemoveObserver(this, - NOTIFY_NEW_USER_SCRIPTS, + NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, NotificationService::AllSources()); // Clean up test directory. @@ -51,7 +51,7 @@ class GreasemonkeyMasterTest : public testing::Test, virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NOTIFY_NEW_USER_SCRIPTS); + DCHECK(type == NOTIFY_GREASEMONKEY_SCRIPTS_LOADED); shared_memory_ = Details<base::SharedMemory>(details).ptr(); if (MessageLoop::current() == &message_loop_) diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index d5ce7fb..f68c2c1 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/profile.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -72,15 +73,15 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal( // static ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord( Profile* profile) { - DCHECK(profile->IsOffTheRecord());
- ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
-
- // Share the same proxy service as the original profile. This proxy
- // service's lifespan is dependent on the lifespan of the original profile,
- // which we reference (see above).
- context->proxy_service_ =
- profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
-
+ DCHECK(profile->IsOffTheRecord()); + ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); + + // Share the same proxy service as the original profile. This proxy + // service's lifespan is dependent on the lifespan of the original profile, + // which we reference (see above). + context->proxy_service_ = + profile->GetOriginalProfile()->GetRequestContext()->proxy_service(); + context->http_transaction_factory_ = new net::HttpCache(context->proxy_service_, 0); context->cookie_store_ = new net::CookieMonster; @@ -103,8 +104,18 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile) cookie_policy_.SetType(net::CookiePolicy::FromInt( prefs_->GetInteger(prefs::kCookieBehavior))); + const ExtensionList* extensions = + profile->GetExtensionsService()->extensions(); + for (ExtensionList::const_iterator iter = extensions->begin(); + iter != extensions->end(); ++iter) { + extension_paths_[(*iter)->id()] = (*iter)->path(); + } + prefs_->AddPrefObserver(prefs::kAcceptLanguages, this); prefs_->AddPrefObserver(prefs::kCookieBehavior, this); + + NotificationService::current()->AddObserver( + this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources()); } // NotificationObserver implementation. @@ -130,6 +141,18 @@ void ChromeURLRequestContext::Observe(NotificationType type, &ChromeURLRequestContext::OnCookiePolicyChange, type)); } + } else if (NOTIFY_EXTENSIONS_LOADED == type) { + ExtensionPaths* new_paths = new ExtensionPaths; + ExtensionList* extensions = Details<ExtensionList>(details).ptr(); + DCHECK(extensions); + for (ExtensionList::const_iterator iter = extensions->begin(); + iter != extensions->end(); ++iter) { + new_paths->insert(ExtensionPaths::value_type((*iter)->id(), + (*iter)->path())); + } + g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, &ChromeURLRequestContext::OnNewExtensions, + new_paths)); } else { NOTREACHED(); } @@ -140,6 +163,18 @@ void ChromeURLRequestContext::CleanupOnUIThread() { prefs_->RemovePrefObserver(prefs::kAcceptLanguages, this); prefs_->RemovePrefObserver(prefs::kCookieBehavior, this); prefs_ = NULL; + + NotificationService::current()->RemoveObserver( + this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources()); +} + +FilePath ChromeURLRequestContext::GetPathForExtension(const std::string& id) { + ExtensionPaths::iterator iter = extension_paths_.find(id); + if (iter != extension_paths_.end()) { + return iter->second; + } else { + return FilePath(); + } } void ChromeURLRequestContext::OnAcceptLanguageChange(std::string accept_language) { @@ -154,6 +189,11 @@ void ChromeURLRequestContext::OnCookiePolicyChange(net::CookiePolicy::Type type) cookie_policy_.SetType(type); } +void ChromeURLRequestContext::OnNewExtensions(ExtensionPaths* new_paths) { + extension_paths_.insert(new_paths->begin(), new_paths->end()); + delete new_paths; +} + ChromeURLRequestContext::~ChromeURLRequestContext() { DCHECK(NULL == prefs_); diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index ab62e60..7cd95f1 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/file_path.h" #include "chrome/common/net/cookie_monster_sqlite.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_service.h" @@ -19,6 +20,8 @@ class Profile; class ChromeURLRequestContext : public URLRequestContext, public NotificationObserver { public: + typedef std::map<std::string, FilePath> ExtensionPaths; + // Create an instance for use with an 'original' (non-OTR) profile. This is // expected to get called on the UI thread. static ChromeURLRequestContext* CreateOriginal( @@ -33,6 +36,9 @@ class ChromeURLRequestContext : public URLRequestContext, // thread before the instance is deleted on the IO thread. void CleanupOnUIThread(); + // Gets the path to the directory for the specified extension. + FilePath GetPathForExtension(const std::string& id); + private: // Private constructor, use the static factory methods instead. This is // expected to be called on the UI thread. @@ -49,9 +55,16 @@ class ChromeURLRequestContext : public URLRequestContext, // Callback for when the cookie policy changes. void OnCookiePolicyChange(net::CookiePolicy::Type type); + // Callback for when new extensions are loaded. + void OnNewExtensions(ExtensionPaths* new_paths); + // Destructor. virtual ~ChromeURLRequestContext(); + // Maps extension IDs to paths on disk. This is initialized in the + // construtor and updated when extensions changed. + ExtensionPaths extension_paths_; + scoped_ptr<SQLitePersistentCookieStore> cookie_db_; PrefService* prefs_; bool is_off_the_record_; diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc index dc3f84f..1efcd58d 100644 --- a/chrome/browser/render_process_host.cc +++ b/chrome/browser/render_process_host.cc @@ -167,7 +167,7 @@ RenderProcessHost::RenderProcessHost(Profile* profile) profile->GetPrefs()->GetBoolean(prefs::kBlockPopups)); NotificationService::current()->AddObserver(this, - NOTIFY_NEW_USER_SCRIPTS, + NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, NotificationService::AllSources()); // Note: When we create the RenderProcessHost, it's technically backgrounded, @@ -191,7 +191,7 @@ RenderProcessHost::~RenderProcessHost() { profile_->GetPrefs()->RemovePrefObserver(prefs::kBlockPopups, this); NotificationService::current()->RemoveObserver(this, - NOTIFY_NEW_USER_SCRIPTS, + NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, NotificationService::AllSources()); } @@ -819,7 +819,7 @@ void RenderProcessHost::Observe(NotificationType type, } break; } - case NOTIFY_NEW_USER_SCRIPTS: { + case NOTIFY_GREASEMONKEY_SCRIPTS_LOADED: { base::SharedMemory* shared_memory = Details<base::SharedMemory>(details).ptr(); DCHECK(shared_memory); diff --git a/chrome/common/notification_types.h b/chrome/common/notification_types.h index 0e550a2..be77915 100644 --- a/chrome/common/notification_types.h +++ b/chrome/common/notification_types.h @@ -499,7 +499,12 @@ enum NotificationType { // Sent when there are new user scripts available. // The details are a pointer to SharedMemory containing the new scripts. - NOTIFY_NEW_USER_SCRIPTS, + NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, + + // Extensions ---------------------------------------------------------------- + + // Sent when new extensions are loaded. The details are an ExtensionList*. + NOTIFY_EXTENSIONS_LOADED, // Count (must be last) ------------------------------------------------------ // Used to determine the number of notification types. Not valid as diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index 449e822..7e6aef9 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -1072,6 +1072,10 @@ Name="TestExtension" > <File + RelativePath="..\..\browser\extensions\extension_protocol_unittest.cc" + > + </File> + <File RelativePath="..\..\browser\extensions\extension_unittest.cc" > </File> |