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

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

Issue 10692067: Convert PyAuto's NavigateToURL, GetActiveTabIndex, Refresh, RefreshActiveTab, and AppendTab to the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed the return value of AppendTab. Created 8 years, 5 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 | Annotate | Revision Log
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 #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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } else { 389 } else {
390 ObserveTab(content::Source<NavigationController>(source).ptr()); 390 ObserveTab(content::Source<NavigationController>(source).ptr());
391 } 391 }
392 delete this; 392 delete this;
393 } else { 393 } else {
394 NOTREACHED(); 394 NOTREACHED();
395 } 395 }
396 } 396 }
397 397
398 TabAppendedNotificationObserver::TabAppendedNotificationObserver( 398 TabAppendedNotificationObserver::TabAppendedNotificationObserver(
399 Browser* parent, AutomationProvider* automation, 399 Browser* parent,
400 IPC::Message* reply_message) 400 AutomationProvider* automation,
401 IPC::Message* reply_message,
402 bool use_json_interface)
401 : TabStripNotificationObserver(chrome::NOTIFICATION_TAB_PARENTED, 403 : TabStripNotificationObserver(chrome::NOTIFICATION_TAB_PARENTED,
402 automation), 404 automation),
403 parent_(parent), 405 parent_(parent),
404 reply_message_(reply_message) { 406 reply_message_(reply_message),
407 use_json_interface_(use_json_interface) {
405 } 408 }
406 409
407 TabAppendedNotificationObserver::~TabAppendedNotificationObserver() {} 410 TabAppendedNotificationObserver::~TabAppendedNotificationObserver() {}
408 411
409 void TabAppendedNotificationObserver::ObserveTab( 412 void TabAppendedNotificationObserver::ObserveTab(
410 NavigationController* controller) { 413 NavigationController* controller) {
411 if (!automation_) 414 if (!automation_ || !reply_message_.get())
412 return; 415 return;
413 416
414 if (automation_->GetIndexForNavigationController(controller, parent_) == 417 if (automation_->GetIndexForNavigationController(controller, parent_) ==
415 TabStripModel::kNoTab) { 418 TabStripModel::kNoTab) {
416 // This tab notification doesn't belong to the parent_. 419 // This tab notification doesn't belong to the parent_.
417 return; 420 return;
418 } 421 }
419 422
420 new NavigationNotificationObserver(controller, automation_, 423 new NavigationNotificationObserver(controller, automation_,
421 reply_message_.release(), 424 reply_message_.release(),
422 1, false, false); 425 1, false, use_json_interface_);
426 }
427
428 IPC::Message* TabAppendedNotificationObserver::ReleaseReply() {
429 return reply_message_.release();
423 } 430 }
424 431
425 TabClosedNotificationObserver::TabClosedNotificationObserver( 432 TabClosedNotificationObserver::TabClosedNotificationObserver(
426 AutomationProvider* automation, bool wait_until_closed, 433 AutomationProvider* automation, bool wait_until_closed,
427 IPC::Message* reply_message) 434 IPC::Message* reply_message)
428 : TabStripNotificationObserver( 435 : TabStripNotificationObserver(
429 wait_until_closed 436 wait_until_closed
430 ? static_cast<int>(content::NOTIFICATION_WEB_CONTENTS_DESTROYED) 437 ? static_cast<int>(content::NOTIFICATION_WEB_CONTENTS_DESTROYED)
431 : static_cast<int>(chrome::NOTIFICATION_TAB_CLOSING), 438 : static_cast<int>(chrome::NOTIFICATION_TAB_CLOSING),
432 automation), 439 automation),
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 if (automation_) { 3099 if (automation_) {
3093 AutomationJSONReply(automation_, reply_message_.release()) 3100 AutomationJSONReply(automation_, reply_message_.release())
3094 .SendSuccess(NULL); 3101 .SendSuccess(NULL);
3095 } 3102 }
3096 delete this; 3103 delete this;
3097 } 3104 }
3098 } else { 3105 } else {
3099 NOTREACHED(); 3106 NOTREACHED();
3100 } 3107 }
3101 } 3108 }
3102
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698