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

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

Issue 8790003: Allow the automation provider to accept an ID for performing render-view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... 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/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 IPC::Message* reply_message, 274 IPC::Message* reply_message,
275 int number_of_navigations, 275 int number_of_navigations,
276 bool include_current_navigation, 276 bool include_current_navigation,
277 bool use_json_interface) 277 bool use_json_interface)
278 : automation_(automation->AsWeakPtr()), 278 : automation_(automation->AsWeakPtr()),
279 reply_message_(reply_message), 279 reply_message_(reply_message),
280 controller_(controller), 280 controller_(controller),
281 navigations_remaining_(number_of_navigations), 281 navigations_remaining_(number_of_navigations),
282 navigation_started_(false), 282 navigation_started_(false),
283 use_json_interface_(use_json_interface) { 283 use_json_interface_(use_json_interface) {
284 if (number_of_navigations == 0) {
285 ConditionMet(AUTOMATION_MSG_NAVIGATION_SUCCESS);
286 return;
287 }
284 DCHECK_LT(0, navigations_remaining_); 288 DCHECK_LT(0, navigations_remaining_);
285 content::Source<NavigationController> source(controller_); 289 content::Source<NavigationController> source(controller_);
286 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); 290 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source);
287 registrar_.Add(this, content::NOTIFICATION_LOAD_START, source); 291 registrar_.Add(this, content::NOTIFICATION_LOAD_START, source);
288 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); 292 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source);
289 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); 293 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source);
290 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); 294 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source);
291 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); 295 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source);
292 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 296 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
293 content::NotificationService::AllSources()); 297 content::NotificationService::AllSources());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: 649 case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR:
646 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: 650 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR:
647 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: 651 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED:
648 break; 652 break;
649 default: 653 default:
650 NOTREACHED(); 654 NOTREACHED();
651 break; 655 break;
652 } 656 }
653 657
654 if (use_json_) { 658 if (use_json_) {
655 DictionaryValue dict; 659 AutomationJSONReply reply(automation_, reply_message_.release());
656 dict.SetString("id", extension_->id()); 660 if (extension_) {
657 AutomationJSONReply(automation_, reply_message_.release()) 661 DictionaryValue dict;
658 .SendSuccess(&dict); 662 dict.SetString("id", extension_->id());
663 reply.SendSuccess(&dict);
664 } else {
665 reply.SendError("Extension could not be installed");
666 }
659 } else { 667 } else {
660 if (id_ == AutomationMsg_InstallExtension::ID) { 668 if (id_ == AutomationMsg_InstallExtension::ID) {
661 // A handle of zero indicates an error. 669 // A handle of zero indicates an error.
662 int extension_handle = 0; 670 int extension_handle = 0;
663 if (extension_) 671 if (extension_)
664 extension_handle = automation_->AddExtension(extension_); 672 extension_handle = automation_->AddExtension(extension_);
665 AutomationMsg_InstallExtension::WriteReplyParams( 673 AutomationMsg_InstallExtension::WriteReplyParams(
666 reply_message_.get(), extension_handle); 674 reply_message_.get(), extension_handle);
667 } else if (id_ == AutomationMsg_EnableExtension::ID) { 675 } else if (id_ == AutomationMsg_EnableExtension::ID) {
668 AutomationMsg_EnableExtension::WriteReplyParams( 676 AutomationMsg_EnableExtension::WriteReplyParams(
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 } 3047 }
3040 } 3048 }
3041 3049
3042 // static 3050 // static
3043 void PolicyUpdatesObserver::PostTask(content::BrowserThread::ID id, 3051 void PolicyUpdatesObserver::PostTask(content::BrowserThread::ID id,
3044 const base::Closure& callback) { 3052 const base::Closure& callback) {
3045 content::BrowserThread::PostTask(id, FROM_HERE, callback); 3053 content::BrowserThread::PostTask(id, FROM_HERE, callback);
3046 } 3054 }
3047 3055
3048 #endif // defined(ENABLE_CONFIGURATION_POLICY) 3056 #endif // defined(ENABLE_CONFIGURATION_POLICY)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698