Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 280853004: Use EventRouter::Get instead of ExtensionSystem::Get(browser_context)->event_router() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 GetExtensionId()); 290 GetExtensionId());
291 } 291 }
292 292
293 content::RenderProcessHost* AddFilenameDeterminer() { 293 content::RenderProcessHost* AddFilenameDeterminer() {
294 ExtensionDownloadsEventRouter::SetDetermineFilenameTimeoutSecondsForTesting( 294 ExtensionDownloadsEventRouter::SetDetermineFilenameTimeoutSecondsForTesting(
295 2); 295 2);
296 content::WebContents* tab = chrome::AddSelectedTabWithURL( 296 content::WebContents* tab = chrome::AddSelectedTabWithURL(
297 current_browser(), 297 current_browser(),
298 extension_->GetResourceURL("empty.html"), 298 extension_->GetResourceURL("empty.html"),
299 content::PAGE_TRANSITION_LINK); 299 content::PAGE_TRANSITION_LINK);
300 extensions::ExtensionSystem::Get(current_browser()->profile()) 300 extensions::EventRouter::Get(current_browser()->profile())
Devlin 2014/05/16 15:32:53 Since this is in the extensions namespace, can you
limasdf 2014/05/16 16:25:03 Done.
301 ->event_router()
302 ->AddEventListener(downloads::OnDeterminingFilename::kEventName, 301 ->AddEventListener(downloads::OnDeterminingFilename::kEventName,
303 tab->GetRenderProcessHost(), 302 tab->GetRenderProcessHost(),
304 GetExtensionId()); 303 GetExtensionId());
305 return tab->GetRenderProcessHost(); 304 return tab->GetRenderProcessHost();
306 } 305 }
307 306
308 void RemoveFilenameDeterminer(content::RenderProcessHost* host) { 307 void RemoveFilenameDeterminer(content::RenderProcessHost* host) {
309 extensions::ExtensionSystem::Get(current_browser()->profile()) 308 extensions::EventRouter::Get(current_browser()->profile())
310 ->event_router()
311 ->RemoveEventListener(downloads::OnDeterminingFilename::kEventName, 309 ->RemoveEventListener(downloads::OnDeterminingFilename::kEventName,
312 host, 310 host,
313 GetExtensionId()); 311 GetExtensionId());
314 } 312 }
315 313
316 Browser* current_browser() { return current_browser_; } 314 Browser* current_browser() { return current_browser_; }
317 315
318 // InProcessBrowserTest 316 // InProcessBrowserTest
319 virtual void SetUpOnMainThread() OVERRIDE { 317 virtual void SetUpOnMainThread() OVERRIDE {
320 ExtensionApiTest::SetUpOnMainThread(); 318 ExtensionApiTest::SetUpOnMainThread();
(...skipping 3776 matching lines...) Expand 10 before | Expand all | Expand 10 after
4097 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 4095 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
4098 EXPECT_FALSE(warnings.empty()); 4096 EXPECT_FALSE(warnings.empty());
4099 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, 4097 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict,
4100 warnings.begin()->warning_type()); 4098 warnings.begin()->warning_type());
4101 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 4099 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
4102 } 4100 }
4103 4101
4104 } // namespace extensions 4102 } // namespace extensions
4105 4103
4106 #endif // http://crbug.com/3061144 4104 #endif // http://crbug.com/3061144
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698