Commit f92003d2 authored by limasdf@gmail.com's avatar limasdf@gmail.com

Use EventRouter::Get instead of ExtensionSystem::Get(browser_context)->event_router()

from c/b/e/api

and remove unwanted extensions:: prefix.

R=rdevlin.cronin@chromium.org
BUG=362672

Review URL: https://codereview.chromium.org/280853004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271590 0039d316-1c4b-4281-b951-d872f2087c98
parent 3d4d9337
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/values.h" #include "base/values.h"
#include "chrome/common/extensions/api/automation_internal.h" #include "chrome/common/extensions/api/automation_internal.h"
#include "extensions/browser/event_router.h" #include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
#include "ui/accessibility/ax_enums.h" #include "ui/accessibility/ax_enums.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
...@@ -113,10 +112,10 @@ void PopulateNodeData(const ui::AXNodeData& node_data, ...@@ -113,10 +112,10 @@ void PopulateNodeData(const ui::AXNodeData& node_data,
void DispatchEventInternal(content::BrowserContext* context, void DispatchEventInternal(content::BrowserContext* context,
const std::string& event_name, const std::string& event_name,
scoped_ptr<base::ListValue> args) { scoped_ptr<base::ListValue> args) {
if (context && ExtensionSystem::Get(context)->event_router()) { if (context && EventRouter::Get(context)) {
scoped_ptr<Event> event(new Event(event_name, args.Pass())); scoped_ptr<Event> event(new Event(event_name, args.Pass()));
event->restrict_to_browser_context = context; event->restrict_to_browser_context = context;
ExtensionSystem::Get(context)->event_router()->BroadcastEvent(event.Pass()); EventRouter::Get(context)->BroadcastEvent(event.Pass());
} }
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "chrome/browser/extensions/browser_action_test_util.h" #include "chrome/browser/extensions/browser_action_test_util.h"
#include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/history/download_row.h" #include "chrome/browser/history/download_row.h"
#include "chrome/browser/net/url_request_mock_util.h" #include "chrome/browser/net/url_request_mock_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -44,6 +43,7 @@ ...@@ -44,6 +43,7 @@
#include "content/public/common/page_transition_types.h" #include "content/public/common/page_transition_types.h"
#include "content/public/test/download_test_observer.h" #include "content/public/test/download_test_observer.h"
#include "content/test/net/url_request_slow_download_job.h" #include "content/test/net/url_request_slow_download_job.h"
#include "extensions/browser/event_router.h"
#include "net/base/data_url.h" #include "net/base/data_url.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
...@@ -63,9 +63,8 @@ using content::URLRequestSlowDownloadJob; ...@@ -63,9 +63,8 @@ using content::URLRequestSlowDownloadJob;
namespace errors = download_extension_errors; namespace errors = download_extension_errors;
namespace downloads = extensions::api::downloads;
namespace extensions { namespace extensions {
namespace downloads = api::downloads;
namespace { namespace {
...@@ -276,15 +275,15 @@ class DownloadExtensionTest : public ExtensionApiTest { ...@@ -276,15 +275,15 @@ class DownloadExtensionTest : public ExtensionApiTest {
current_browser(), current_browser(),
extension_->GetResourceURL("empty.html"), extension_->GetResourceURL("empty.html"),
content::PAGE_TRANSITION_LINK); content::PAGE_TRANSITION_LINK);
extensions::EventRouter::Get(current_browser()->profile()) EventRouter::Get(current_browser()->profile())
->AddEventListener(downloads::OnCreated::kEventName, ->AddEventListener(downloads::OnCreated::kEventName,
tab->GetRenderProcessHost(), tab->GetRenderProcessHost(),
GetExtensionId()); GetExtensionId());
extensions::EventRouter::Get(current_browser()->profile()) EventRouter::Get(current_browser()->profile())
->AddEventListener(downloads::OnChanged::kEventName, ->AddEventListener(downloads::OnChanged::kEventName,
tab->GetRenderProcessHost(), tab->GetRenderProcessHost(),
GetExtensionId()); GetExtensionId());
extensions::EventRouter::Get(current_browser()->profile()) EventRouter::Get(current_browser()->profile())
->AddEventListener(downloads::OnErased::kEventName, ->AddEventListener(downloads::OnErased::kEventName,
tab->GetRenderProcessHost(), tab->GetRenderProcessHost(),
GetExtensionId()); GetExtensionId());
...@@ -297,8 +296,7 @@ class DownloadExtensionTest : public ExtensionApiTest { ...@@ -297,8 +296,7 @@ class DownloadExtensionTest : public ExtensionApiTest {
current_browser(), current_browser(),
extension_->GetResourceURL("empty.html"), extension_->GetResourceURL("empty.html"),
content::PAGE_TRANSITION_LINK); content::PAGE_TRANSITION_LINK);
extensions::ExtensionSystem::Get(current_browser()->profile()) EventRouter::Get(current_browser()->profile())
->event_router()
->AddEventListener(downloads::OnDeterminingFilename::kEventName, ->AddEventListener(downloads::OnDeterminingFilename::kEventName,
tab->GetRenderProcessHost(), tab->GetRenderProcessHost(),
GetExtensionId()); GetExtensionId());
...@@ -306,11 +304,8 @@ class DownloadExtensionTest : public ExtensionApiTest { ...@@ -306,11 +304,8 @@ class DownloadExtensionTest : public ExtensionApiTest {
} }
void RemoveFilenameDeterminer(content::RenderProcessHost* host) { void RemoveFilenameDeterminer(content::RenderProcessHost* host) {
extensions::ExtensionSystem::Get(current_browser()->profile()) EventRouter::Get(current_browser()->profile())->RemoveEventListener(
->event_router() downloads::OnDeterminingFilename::kEventName, host, GetExtensionId());
->RemoveEventListener(downloads::OnDeterminingFilename::kEventName,
host,
GetExtensionId());
} }
Browser* current_browser() { return current_browser_; } Browser* current_browser() { return current_browser_; }
...@@ -603,7 +598,7 @@ class DownloadExtensionTest : public ExtensionApiTest { ...@@ -603,7 +598,7 @@ class DownloadExtensionTest : public ExtensionApiTest {
} }
base::ScopedTempDir downloads_directory_; base::ScopedTempDir downloads_directory_;
const extensions::Extension* extension_; const Extension* extension_;
Browser* incognito_browser_; Browser* incognito_browser_;
Browser* current_browser_; Browser* current_browser_;
scoped_ptr<DownloadsEventsListener> events_listener_; scoped_ptr<DownloadsEventsListener> events_listener_;
...@@ -4038,7 +4033,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal, ...@@ -4038,7 +4033,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal,
base::FilePath filename; base::FilePath filename;
downloads::FilenameConflictAction conflict_action = downloads::FilenameConflictAction conflict_action =
downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY; downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY;
extensions::ExtensionWarningSet warnings; ExtensionWarningSet warnings;
// Empty incumbent determiner // Empty incumbent determiner
warnings.clear(); warnings.clear();
...@@ -4075,7 +4070,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal, ...@@ -4075,7 +4070,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal,
EXPECT_EQ(FILE_PATH_LITERAL("a"), filename.value()); EXPECT_EQ(FILE_PATH_LITERAL("a"), filename.value());
EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_OVERWRITE, conflict_action); EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_OVERWRITE, conflict_action);
EXPECT_FALSE(warnings.empty()); EXPECT_FALSE(warnings.empty());
EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict,
warnings.begin()->warning_type()); warnings.begin()->warning_type());
EXPECT_EQ("suggester", warnings.begin()->extension_id()); EXPECT_EQ("suggester", warnings.begin()->extension_id());
...@@ -4096,7 +4091,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal, ...@@ -4096,7 +4091,7 @@ TEST(ExtensionDetermineDownloadFilenameInternal,
EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value());
EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
EXPECT_FALSE(warnings.empty()); EXPECT_FALSE(warnings.empty());
EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict,
warnings.begin()->warning_type()); warnings.begin()->warning_type());
EXPECT_EQ("incumbent", warnings.begin()->extension_id()); EXPECT_EQ("incumbent", warnings.begin()->extension_id());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment