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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 8697006: DownloadManager intereface refactoring to allow cleaner DownloadItem unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 return; 3152 return;
3153 } 3153 }
3154 3154
3155 if (action == "open") { 3155 if (action == "open") {
3156 selected_item->AddObserver( 3156 selected_item->AddObserver(
3157 new AutomationProviderDownloadUpdatedObserver( 3157 new AutomationProviderDownloadUpdatedObserver(
3158 this, reply_message, true)); 3158 this, reply_message, true));
3159 selected_item->OpenDownload(); 3159 selected_item->OpenDownload();
3160 } else if (action == "toggle_open_files_like_this") { 3160 } else if (action == "toggle_open_files_like_this") {
3161 DownloadPrefs* prefs = 3161 DownloadPrefs* prefs =
3162 DownloadPrefs::FromDownloadManager(selected_item->GetDownloadManager()); 3162 DownloadPrefs::FromBrowserContext(selected_item->BrowserContext());
3163 FilePath path = selected_item->GetUserVerifiedFilePath(); 3163 FilePath path = selected_item->GetUserVerifiedFilePath();
3164 if (!selected_item->ShouldOpenFileBasedOnExtension()) 3164 if (!selected_item->ShouldOpenFileBasedOnExtension())
3165 prefs->EnableAutoOpenBasedOnExtension(path); 3165 prefs->EnableAutoOpenBasedOnExtension(path);
3166 else 3166 else
3167 prefs->DisableAutoOpenBasedOnExtension(path); 3167 prefs->DisableAutoOpenBasedOnExtension(path);
3168 AutomationJSONReply(this, reply_message).SendSuccess(NULL); 3168 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
3169 } else if (action == "remove") { 3169 } else if (action == "remove") {
3170 download_manager->AddObserver( 3170 download_manager->AddObserver(
3171 new AutomationProviderDownloadModelChangedObserver( 3171 new AutomationProviderDownloadModelChangedObserver(
3172 this, reply_message, download_manager)); 3172 this, reply_message, download_manager));
(...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after
6431 6431
6432 Send(reply_message_); 6432 Send(reply_message_);
6433 redirect_query_ = 0; 6433 redirect_query_ = 0;
6434 reply_message_ = NULL; 6434 reply_message_ = NULL;
6435 } 6435 }
6436 6436
6437 void TestingAutomationProvider::OnRemoveProvider() { 6437 void TestingAutomationProvider::OnRemoveProvider() {
6438 if (g_browser_process) 6438 if (g_browser_process)
6439 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6439 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6440 } 6440 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698