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

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

Issue 7006010: Change InfoBar-related notifications to be sourced from a TabContentsWrapper, not a TabContents. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 translate_bar_->GetOriginalLanguageCode()); 1356 translate_bar_->GetOriginalLanguageCode());
1357 return_value->Set("translate_bar", bar_info); 1357 return_value->Set("translate_bar", bar_info);
1358 } 1358 }
1359 AutomationJSONReply(automation_, reply_message_.release()) 1359 AutomationJSONReply(automation_, reply_message_.release())
1360 .SendSuccess(return_value.get()); 1360 .SendSuccess(return_value.get());
1361 delete this; 1361 delete this;
1362 } 1362 }
1363 1363
1364 InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, 1364 InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation,
1365 IPC::Message* reply_message, 1365 IPC::Message* reply_message,
1366 TabContents* tab_contents, 1366 TabContentsWrapper* tab_contents,
1367 size_t target_count) 1367 size_t target_count)
1368 : automation_(automation->AsWeakPtr()), 1368 : automation_(automation->AsWeakPtr()),
1369 reply_message_(reply_message), 1369 reply_message_(reply_message),
1370 tab_contents_(tab_contents), 1370 tab_contents_(tab_contents),
1371 target_count_(target_count) { 1371 target_count_(target_count) {
1372 Source<TabContents> source(tab_contents); 1372 Source<TabContentsWrapper> source(tab_contents);
1373 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source); 1373 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source);
1374 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); 1374 registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source);
1375 CheckCount(); 1375 CheckCount();
1376 } 1376 }
1377 1377
1378 InfoBarCountObserver::~InfoBarCountObserver() {} 1378 InfoBarCountObserver::~InfoBarCountObserver() {}
1379 1379
1380 void InfoBarCountObserver::Observe(NotificationType type, 1380 void InfoBarCountObserver::Observe(NotificationType type,
1381 const NotificationSource& source, 1381 const NotificationSource& source,
1382 const NotificationDetails& details) { 1382 const NotificationDetails& details) {
1383 DCHECK(type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED || 1383 DCHECK(type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED ||
1384 type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED); 1384 type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED);
1385 CheckCount(); 1385 CheckCount();
1386 } 1386 }
1387 1387
1388 void InfoBarCountObserver::CheckCount() { 1388 void InfoBarCountObserver::CheckCount() {
1389 TabContentsWrapper* wrapper = 1389 if (tab_contents_->infobar_count() != target_count_)
1390 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_);
1391 if (wrapper->infobar_count() != target_count_)
1392 return; 1390 return;
1393 1391
1394 if (automation_) { 1392 if (automation_) {
1395 AutomationMsg_WaitForInfoBarCount::WriteReplyParams(reply_message_.get(), 1393 AutomationMsg_WaitForInfoBarCount::WriteReplyParams(reply_message_.get(),
1396 true); 1394 true);
1397 automation_->Send(reply_message_.release()); 1395 automation_->Send(reply_message_.release());
1398 } 1396 }
1399 delete this; 1397 delete this;
1400 } 1398 }
1401 1399
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2573 this, 2571 this,
2574 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); 2572 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread));
2575 } 2573 }
2576 2574
2577 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { 2575 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() {
2578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2576 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2579 if (automation_) 2577 if (automation_)
2580 automation_->Send(reply_message_.release()); 2578 automation_->Send(reply_message_.release());
2581 Release(); 2579 Release();
2582 } 2580 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698