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

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

Issue 10536058: TabContentsWrapper -> TabContents, part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: GetOwningTabContentsForWebContents Created 8 years, 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 53 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
54 #include "chrome/browser/tab_contents/thumbnail_generator.h" 54 #include "chrome/browser/tab_contents/thumbnail_generator.h"
55 #include "chrome/browser/translate/page_translated_details.h" 55 #include "chrome/browser/translate/page_translated_details.h"
56 #include "chrome/browser/translate/translate_infobar_delegate.h" 56 #include "chrome/browser/translate/translate_infobar_delegate.h"
57 #include "chrome/browser/translate/translate_tab_helper.h" 57 #include "chrome/browser/translate/translate_tab_helper.h"
58 #include "chrome/browser/ui/browser.h" 58 #include "chrome/browser/ui/browser.h"
59 #include "chrome/browser/ui/browser_list.h" 59 #include "chrome/browser/ui/browser_list.h"
60 #include "chrome/browser/ui/browser_window.h" 60 #include "chrome/browser/ui/browser_window.h"
61 #include "chrome/browser/ui/find_bar/find_notification_details.h" 61 #include "chrome/browser/ui/find_bar/find_notification_details.h"
62 #include "chrome/browser/ui/login/login_prompt.h" 62 #include "chrome/browser/ui/login/login_prompt.h"
63 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 63 #include "chrome/browser/ui/tab_contents/tab_contents.h"
64 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 64 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
65 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" 65 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
66 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 66 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
67 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" 67 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h"
68 #include "chrome/common/automation_constants.h" 68 #include "chrome/common/automation_constants.h"
69 #include "chrome/common/automation_messages.h" 69 #include "chrome/common/automation_messages.h"
70 #include "chrome/common/chrome_notification_types.h" 70 #include "chrome/common/chrome_notification_types.h"
71 #include "chrome/common/content_settings_types.h" 71 #include "chrome/common/content_settings_types.h"
72 #include "chrome/common/extensions/extension.h" 72 #include "chrome/common/extensions/extension.h"
73 #include "chrome/common/view_type.h" 73 #include "chrome/common/view_type.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 TabStripNotificationObserver::~TabStripNotificationObserver() { 375 TabStripNotificationObserver::~TabStripNotificationObserver() {
376 } 376 }
377 377
378 void TabStripNotificationObserver::Observe( 378 void TabStripNotificationObserver::Observe(
379 int type, 379 int type,
380 const content::NotificationSource& source, 380 const content::NotificationSource& source,
381 const content::NotificationDetails& details) { 381 const content::NotificationDetails& details) {
382 if (type == notification_) { 382 if (type == notification_) {
383 if (type == chrome::NOTIFICATION_TAB_PARENTED) { 383 if (type == chrome::NOTIFICATION_TAB_PARENTED) {
384 ObserveTab(&(content::Source<TabContentsWrapper>(source).ptr()-> 384 ObserveTab(&(content::Source<TabContents>(source).ptr()->
385 web_contents()->GetController())); 385 web_contents()->GetController()));
386 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { 386 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
387 ObserveTab(&(content::Source<content::WebContents>(source).ptr()-> 387 ObserveTab(&(content::Source<content::WebContents>(source).ptr()->
388 GetController())); 388 GetController()));
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();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 tab_strip_model_(browser->tab_strip_model()), 464 tab_strip_model_(browser->tab_strip_model()),
465 target_tab_count_(target_tab_count) { 465 target_tab_count_(target_tab_count) {
466 tab_strip_model_->AddObserver(this); 466 tab_strip_model_->AddObserver(this);
467 CheckTabCount(); 467 CheckTabCount();
468 } 468 }
469 469
470 TabCountChangeObserver::~TabCountChangeObserver() { 470 TabCountChangeObserver::~TabCountChangeObserver() {
471 tab_strip_model_->RemoveObserver(this); 471 tab_strip_model_->RemoveObserver(this);
472 } 472 }
473 473
474 void TabCountChangeObserver::TabInsertedAt(TabContentsWrapper* contents, 474 void TabCountChangeObserver::TabInsertedAt(TabContents* contents,
475 int index, 475 int index,
476 bool foreground) { 476 bool foreground) {
477 CheckTabCount(); 477 CheckTabCount();
478 } 478 }
479 479
480 void TabCountChangeObserver::TabDetachedAt(TabContentsWrapper* contents, 480 void TabCountChangeObserver::TabDetachedAt(TabContents* contents,
481 int index) { 481 int index) {
482 CheckTabCount(); 482 CheckTabCount();
483 } 483 }
484 484
485 void TabCountChangeObserver::TabStripModelDeleted() { 485 void TabCountChangeObserver::TabStripModelDeleted() {
486 if (automation_) { 486 if (automation_) {
487 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams( 487 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(
488 reply_message_.get(), false); 488 reply_message_.get(), false);
489 automation_->Send(reply_message_.release()); 489 automation_->Send(reply_message_.release());
490 } 490 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 794
795 if (type == chrome::NOTIFICATION_BROWSER_OPENED) { 795 if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
796 // Store the new browser ID and continue waiting for a new tab within it 796 // Store the new browser ID and continue waiting for a new tab within it
797 // to stop loading. 797 // to stop loading.
798 new_window_id_ = ExtensionTabUtil::GetWindowId( 798 new_window_id_ = ExtensionTabUtil::GetWindowId(
799 content::Source<Browser>(source).ptr()); 799 content::Source<Browser>(source).ptr());
800 } else if (type == content::NOTIFICATION_LOAD_STOP) { 800 } else if (type == content::NOTIFICATION_LOAD_STOP) {
801 // Only send the result if the loaded tab is in the new window. 801 // Only send the result if the loaded tab is in the new window.
802 NavigationController* controller = 802 NavigationController* controller =
803 content::Source<NavigationController>(source).ptr(); 803 content::Source<NavigationController>(source).ptr();
804 TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( 804 TabContents* tab = TabContents::GetOwningTabContentsForWebContents(
jam 2012/06/07 21:39:20 nit: i do wonder if this should just be TabContent
805 controller->GetWebContents()); 805 controller->GetWebContents());
806 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; 806 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1;
807 if (window_id == new_window_id_) { 807 if (window_id == new_window_id_) {
808 if (for_browser_command_) { 808 if (for_browser_command_) {
809 AutomationMsg_WindowExecuteCommand::WriteReplyParams( 809 AutomationMsg_WindowExecuteCommand::WriteReplyParams(
810 reply_message_.get(), true); 810 reply_message_.get(), true);
811 } 811 }
812 automation_->Send(reply_message_.release()); 812 automation_->Send(reply_message_.release());
813 delete this; 813 delete this;
814 return; 814 return;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 case IDC_CLOSE_TAB: { 963 case IDC_CLOSE_TAB: {
964 TabClosedNotificationObserver* observer = 964 TabClosedNotificationObserver* observer =
965 new TabClosedNotificationObserver(automation, true, reply_message); 965 new TabClosedNotificationObserver(automation, true, reply_message);
966 observer->set_for_browser_command(true); 966 observer->set_for_browser_command(true);
967 break; 967 break;
968 } 968 }
969 case IDC_BACK: 969 case IDC_BACK:
970 case IDC_FORWARD: 970 case IDC_FORWARD:
971 case IDC_RELOAD: { 971 case IDC_RELOAD: {
972 new NavigationNotificationObserver( 972 new NavigationNotificationObserver(
973 &browser->GetSelectedWebContents()->GetController(), 973 &browser->GetActiveWebContents()->GetController(),
974 automation, reply_message, 1, false, false); 974 automation, reply_message, 1, false, false);
975 break; 975 break;
976 } 976 }
977 default: { 977 default: {
978 ExecuteBrowserCommandObserver* observer = 978 ExecuteBrowserCommandObserver* observer =
979 new ExecuteBrowserCommandObserver(automation, reply_message); 979 new ExecuteBrowserCommandObserver(automation, reply_message);
980 if (!observer->Register(command)) { 980 if (!observer->Register(command)) {
981 delete observer; 981 delete observer;
982 result = false; 982 result = false;
983 } 983 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 const content::NotificationDetails& details) { 1111 const content::NotificationDetails& details) {
1112 if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { 1112 if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) {
1113 content::Details<DomOperationNotificationDetails> dom_op_details(details); 1113 content::Details<DomOperationNotificationDetails> dom_op_details(details);
1114 if (dom_op_details->automation_id == automation_id_) 1114 if (dom_op_details->automation_id == automation_id_)
1115 OnDomOperationCompleted(dom_op_details->json); 1115 OnDomOperationCompleted(dom_op_details->json);
1116 } else if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { 1116 } else if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) {
1117 OnModalDialogShown(); 1117 OnModalDialogShown();
1118 } else if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) { 1118 } else if (type == chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED) {
1119 WebContents* web_contents = content::Source<WebContents>(source).ptr(); 1119 WebContents* web_contents = content::Source<WebContents>(source).ptr();
1120 if (web_contents) { 1120 if (web_contents) {
1121 TabContentsWrapper* wrapper = 1121 TabContents* tab_contents =
1122 TabContentsWrapper::GetCurrentWrapperForContents(web_contents); 1122 TabContents::GetOwningTabContentsForWebContents(web_contents);
1123 if (wrapper && 1123 if (tab_contents &&
1124 wrapper->content_settings() && 1124 tab_contents->content_settings() &&
1125 wrapper->content_settings()->IsContentBlocked( 1125 tab_contents->content_settings()->IsContentBlocked(
1126 CONTENT_SETTINGS_TYPE_JAVASCRIPT)) { 1126 CONTENT_SETTINGS_TYPE_JAVASCRIPT)) {
1127 OnJavascriptBlocked(); 1127 OnJavascriptBlocked();
1128 } 1128 }
1129 } 1129 }
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 DomOperationMessageSender::DomOperationMessageSender( 1133 DomOperationMessageSender::DomOperationMessageSender(
1134 AutomationProvider* automation, 1134 AutomationProvider* automation,
1135 IPC::Message* reply_message, 1135 IPC::Message* reply_message,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 void TabLanguageDeterminedObserver::Observe( 1252 void TabLanguageDeterminedObserver::Observe(
1253 int type, const content::NotificationSource& source, 1253 int type, const content::NotificationSource& source,
1254 const content::NotificationDetails& details) { 1254 const content::NotificationDetails& details) {
1255 DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED); 1255 DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED);
1256 1256
1257 if (!automation_) { 1257 if (!automation_) {
1258 delete this; 1258 delete this;
1259 return; 1259 return;
1260 } 1260 }
1261 1261
1262 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( 1262 TranslateTabHelper* helper = TabContents::GetOwningTabContentsForWebContents(
1263 web_contents_)->translate_tab_helper(); 1263 web_contents_)->translate_tab_helper();
1264 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 1264 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
1265 return_value->SetBoolean("page_translated", 1265 return_value->SetBoolean("page_translated",
1266 helper->language_state().IsPageTranslated()); 1266 helper->language_state().IsPageTranslated());
1267 return_value->SetBoolean( 1267 return_value->SetBoolean(
1268 "can_translate_page", TranslatePrefs::CanTranslate( 1268 "can_translate_page", TranslatePrefs::CanTranslate(
1269 automation_->profile()->GetPrefs(), 1269 automation_->profile()->GetPrefs(),
1270 helper->language_state().original_language(), 1270 helper->language_state().original_language(),
1271 web_contents_->GetURL())); 1271 web_contents_->GetURL()));
1272 return_value->SetString("original_language", 1272 return_value->SetString("original_language",
(...skipping 23 matching lines...) Expand all
1296 translate_bar_->GetOriginalLanguageCode()); 1296 translate_bar_->GetOriginalLanguageCode());
1297 return_value->Set("translate_bar", bar_info); 1297 return_value->Set("translate_bar", bar_info);
1298 } 1298 }
1299 AutomationJSONReply(automation_, reply_message_.release()) 1299 AutomationJSONReply(automation_, reply_message_.release())
1300 .SendSuccess(return_value.get()); 1300 .SendSuccess(return_value.get());
1301 delete this; 1301 delete this;
1302 } 1302 }
1303 1303
1304 InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, 1304 InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation,
1305 IPC::Message* reply_message, 1305 IPC::Message* reply_message,
1306 TabContentsWrapper* tab_contents, 1306 TabContents* tab_contents,
1307 size_t target_count) 1307 size_t target_count)
1308 : automation_(automation->AsWeakPtr()), 1308 : automation_(automation->AsWeakPtr()),
1309 reply_message_(reply_message), 1309 reply_message_(reply_message),
1310 tab_contents_(tab_contents), 1310 tab_contents_(tab_contents),
1311 target_count_(target_count) { 1311 target_count_(target_count) {
1312 content::Source<InfoBarTabHelper> source(tab_contents->infobar_tab_helper()); 1312 content::Source<InfoBarTabHelper> source(tab_contents->infobar_tab_helper());
1313 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 1313 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
1314 source); 1314 source);
1315 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 1315 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
1316 source); 1316 source);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 reply_message_.release()).SendSuccess(NULL); 1801 reply_message_.release()).SendSuccess(NULL);
1802 } 1802 }
1803 delete this; 1803 delete this;
1804 } else { 1804 } else {
1805 NOTREACHED(); 1805 NOTREACHED();
1806 } 1806 }
1807 } 1807 }
1808 1808
1809 PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation, 1809 PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation,
1810 IPC::Message* reply_message, 1810 IPC::Message* reply_message,
1811 TabContentsWrapper* tab_contents, 1811 TabContents* tab_contents,
1812 const FilePath& path) 1812 const FilePath& path)
1813 : automation_(automation->AsWeakPtr()), 1813 : automation_(automation->AsWeakPtr()),
1814 reply_message_(reply_message), 1814 reply_message_(reply_message),
1815 tab_contents_(tab_contents), 1815 tab_contents_(tab_contents),
1816 image_path_(path) { 1816 image_path_(path) {
1817 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 1817 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
1818 content::NotificationService::AllSources()); 1818 content::NotificationService::AllSources());
1819 } 1819 }
1820 1820
1821 PageSnapshotTaker::~PageSnapshotTaker() {} 1821 PageSnapshotTaker::~PageSnapshotTaker() {}
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 if (automation_) { 2143 if (automation_) {
2144 AutomationJSONReply(automation_, 2144 AutomationJSONReply(automation_,
2145 reply_message_.release()).SendSuccess(NULL); 2145 reply_message_.release()).SendSuccess(NULL);
2146 } 2146 }
2147 delete this; 2147 delete this;
2148 return; 2148 return;
2149 } else { 2149 } else {
2150 // The app has launched only if the loaded tab is in the new window. 2150 // The app has launched only if the loaded tab is in the new window.
2151 NavigationController* controller = 2151 NavigationController* controller =
2152 content::Source<NavigationController>(source).ptr(); 2152 content::Source<NavigationController>(source).ptr();
2153 TabContentsWrapper* tab = 2153 TabContents* tab =
2154 TabContentsWrapper::GetCurrentWrapperForContents( 2154 TabContents::GetOwningTabContentsForWebContents(
2155 controller->GetWebContents()); 2155 controller->GetWebContents());
2156 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; 2156 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1;
2157 if (window_id == new_window_id_) { 2157 if (window_id == new_window_id_) {
2158 if (automation_) { 2158 if (automation_) {
2159 AutomationJSONReply(automation_, 2159 AutomationJSONReply(automation_,
2160 reply_message_.release()).SendSuccess(NULL); 2160 reply_message_.release()).SendSuccess(NULL);
2161 } 2161 }
2162 delete this; 2162 delete this;
2163 return; 2163 return;
2164 } 2164 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 2578 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
2579 content::NotificationService::AllSources()); 2579 content::NotificationService::AllSources());
2580 registrar_.Add(this, 2580 registrar_.Add(this,
2581 content::NOTIFICATION_LOAD_STOP, 2581 content::NOTIFICATION_LOAD_STOP,
2582 content::NotificationService::AllSources()); 2582 content::NotificationService::AllSources());
2583 for (BrowserList::const_iterator iter = BrowserList::begin(); 2583 for (BrowserList::const_iterator iter = BrowserList::begin();
2584 iter != BrowserList::end(); 2584 iter != BrowserList::end();
2585 ++iter) { 2585 ++iter) {
2586 Browser* browser = *iter; 2586 Browser* browser = *iter;
2587 for (int i = 0; i < browser->tab_count(); ++i) { 2587 for (int i = 0; i < browser->tab_count(); ++i) {
2588 TabContentsWrapper* contents_wrapper = 2588 TabContents* tab_contents = browser->GetTabContentsAt(i);
2589 browser->GetTabContentsWrapperAt(i); 2589 StartObserving(tab_contents->automation_tab_helper());
2590 StartObserving(contents_wrapper->automation_tab_helper()); 2590 if (tab_contents->automation_tab_helper()->has_pending_loads())
2591 if (contents_wrapper->automation_tab_helper()->has_pending_loads()) 2591 pending_tabs_.insert(tab_contents->web_contents());
2592 pending_tabs_.insert(contents_wrapper->web_contents());
2593 } 2592 }
2594 } 2593 }
2595 CheckIfNoMorePendingLoads(); 2594 CheckIfNoMorePendingLoads();
2596 } 2595 }
2597 2596
2598 AllViewsStoppedLoadingObserver::~AllViewsStoppedLoadingObserver() { 2597 AllViewsStoppedLoadingObserver::~AllViewsStoppedLoadingObserver() {
2599 } 2598 }
2600 2599
2601 void AllViewsStoppedLoadingObserver::OnFirstPendingLoad( 2600 void AllViewsStoppedLoadingObserver::OnFirstPendingLoad(
2602 content::WebContents* web_contents) { 2601 content::WebContents* web_contents) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 registrar_.Add(this, 2658 registrar_.Add(this,
2660 chrome::NOTIFICATION_TAB_PARENTED, 2659 chrome::NOTIFICATION_TAB_PARENTED,
2661 content::NotificationService::AllSources()); 2660 content::NotificationService::AllSources());
2662 } 2661 }
2663 2662
2664 void NewTabObserver::Observe(int type, 2663 void NewTabObserver::Observe(int type,
2665 const content::NotificationSource& source, 2664 const content::NotificationSource& source,
2666 const content::NotificationDetails& details) { 2665 const content::NotificationDetails& details) {
2667 DCHECK_EQ(chrome::NOTIFICATION_TAB_PARENTED, type); 2666 DCHECK_EQ(chrome::NOTIFICATION_TAB_PARENTED, type);
2668 NavigationController* controller = 2667 NavigationController* controller =
2669 &(content::Source<TabContentsWrapper>(source).ptr()-> 2668 &(content::Source<TabContents>(source).ptr()->
2670 web_contents()->GetController()); 2669 web_contents()->GetController());
2671 if (automation_) { 2670 if (automation_) {
2672 // TODO(phajdan.jr): Clean up this hack. We write the correct return type 2671 // TODO(phajdan.jr): Clean up this hack. We write the correct return type
2673 // here, but don't send the message. NavigationNotificationObserver 2672 // here, but don't send the message. NavigationNotificationObserver
2674 // will wait properly for the load to finish, and send the message, 2673 // will wait properly for the load to finish, and send the message,
2675 // but it will also append its own return value at the end of the reply. 2674 // but it will also append its own return value at the end of the reply.
2676 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(), 2675 AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message_.get(),
2677 true); 2676 true);
2678 new NavigationNotificationObserver(controller, automation_, 2677 new NavigationNotificationObserver(controller, automation_,
2679 reply_message_.release(), 2678 reply_message_.release(),
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 } 2971 }
2973 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) { 2972 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED) {
2974 // Store the new browser ID and continue waiting for a new tab within it 2973 // Store the new browser ID and continue waiting for a new tab within it
2975 // to stop loading. 2974 // to stop loading.
2976 new_window_id_ = ExtensionTabUtil::GetWindowId( 2975 new_window_id_ = ExtensionTabUtil::GetWindowId(
2977 content::Source<Browser>(source).ptr()); 2976 content::Source<Browser>(source).ptr());
2978 } else if (type == content::NOTIFICATION_LOAD_STOP) { 2977 } else if (type == content::NOTIFICATION_LOAD_STOP) {
2979 // Only send the result if the loaded tab is in the new window. 2978 // Only send the result if the loaded tab is in the new window.
2980 NavigationController* controller = 2979 NavigationController* controller =
2981 content::Source<NavigationController>(source).ptr(); 2980 content::Source<NavigationController>(source).ptr();
2982 TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( 2981 TabContents* tab = TabContents::GetOwningTabContentsForWebContents(
2983 controller->GetWebContents()); 2982 controller->GetWebContents());
2984 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1; 2983 int window_id = tab ? tab->restore_tab_helper()->window_id().id() : -1;
2985 if (window_id == new_window_id_) { 2984 if (window_id == new_window_id_) {
2986 if (automation_) { 2985 if (automation_) {
2987 AutomationJSONReply(automation_, reply_message_.release()) 2986 AutomationJSONReply(automation_, reply_message_.release())
2988 .SendSuccess(NULL); 2987 .SendSuccess(NULL);
2989 } 2988 }
2990 delete this; 2989 delete this;
2991 } 2990 }
2992 } else { 2991 } else {
(...skipping 25 matching lines...) Expand all
3018 } 3017 }
3019 3018
3020 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); 3019 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
3021 if (host->extension_id() == extension_id_ && 3020 if (host->extension_id() == extension_id_ &&
3022 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { 3021 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) {
3023 AutomationJSONReply(automation_, reply_message_.release()) 3022 AutomationJSONReply(automation_, reply_message_.release())
3024 .SendSuccess(NULL); 3023 .SendSuccess(NULL);
3025 delete this; 3024 delete this;
3026 } 3025 }
3027 } 3026 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/automation_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698