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

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

Issue 6614023: Convert ChromeDriver to use only the JSON automation interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Pawel's additional comments Created 9 years, 9 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) 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 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 AllTabsStoppedLoadingObserver::~AllTabsStoppedLoadingObserver() {} 2002 AllTabsStoppedLoadingObserver::~AllTabsStoppedLoadingObserver() {}
2003 2003
2004 void AllTabsStoppedLoadingObserver::Observe( 2004 void AllTabsStoppedLoadingObserver::Observe(
2005 NotificationType type, 2005 NotificationType type,
2006 const NotificationSource& source, 2006 const NotificationSource& source,
2007 const NotificationDetails& details) { 2007 const NotificationDetails& details) {
2008 CheckIfStopped(); 2008 CheckIfStopped();
2009 } 2009 }
2010 2010
2011 void AllTabsStoppedLoadingObserver::CheckIfStopped() { 2011 void AllTabsStoppedLoadingObserver::CheckIfStopped() {
2012 if (!automation_) {
2013 delete this;
2014 return;
2015 }
2012 bool done_loading = true; 2016 bool done_loading = true;
2013 BrowserList::const_iterator iter = BrowserList::begin(); 2017 BrowserList::const_iterator iter = BrowserList::begin();
2014 for (; iter != BrowserList::end(); ++iter) { 2018 for (; iter != BrowserList::end(); ++iter) {
2015 Browser* browser = *iter; 2019 Browser* browser = *iter;
2016 for (int i = 0; i < browser->tab_count(); ++i) { 2020 for (int i = 0; i < browser->tab_count(); ++i) {
2017 TabContents* tab = browser->GetTabContentsAt(i); 2021 TabContents* tab = browser->GetTabContentsAt(i);
2018 if (tab->is_loading()) { 2022 if (tab->is_loading()) {
2019 done_loading = false; 2023 done_loading = false;
2020 break; 2024 break;
2021 } 2025 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 NewRunnableMethod( 2092 NewRunnableMethod(
2089 this, 2093 this,
2090 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); 2094 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread));
2091 } 2095 }
2092 2096
2093 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { 2097 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() {
2094 if (automation_) 2098 if (automation_)
2095 automation_->Send(reply_message_.release()); 2099 automation_->Send(reply_message_.release());
2096 Release(); 2100 Release();
2097 } 2101 }
2102
2103 ExecuteJavascriptObserver::ExecuteJavascriptObserver(
2104 AutomationProvider* automation,
2105 IPC::Message* reply_message)
2106 : automation_(automation->AsWeakPtr()),
2107 reply_message_(reply_message) {
2108 }
2109
2110 ExecuteJavascriptObserver::~ExecuteJavascriptObserver() {
2111 }
2112
2113 void ExecuteJavascriptObserver::OnDomOperationCompleted(
2114 const std::string& json) {
2115 if (automation_) {
2116 DictionaryValue dict;
2117 dict.SetString("result", json);
2118 AutomationJSONReply(automation_, reply_message_.release())
2119 .SendSuccess(&dict);
2120 }
2121 delete this;
2122 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/testing_automation_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698