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

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

Issue 14241006: Eliminate InfoBarTabHelper. Make InfoBarService a concrete class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 if (args->GetInteger("height", &height)) 2092 if (args->GetInteger("height", &height))
2093 rect.set_height(height); 2093 rect.set_height(height);
2094 browser->window()->SetBounds(rect); 2094 browser->window()->SetBounds(rect);
2095 AutomationJSONReply(this, reply_message).SendSuccess(NULL); 2095 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
2096 } 2096 }
2097 2097
2098 ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) { 2098 ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
2099 // Each infobar may have different properties depending on the type. 2099 // Each infobar may have different properties depending on the type.
2100 ListValue* infobars = new ListValue; 2100 ListValue* infobars = new ListValue;
2101 InfoBarService* infobar_service = InfoBarService::FromWebContents(wc); 2101 InfoBarService* infobar_service = InfoBarService::FromWebContents(wc);
2102 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { 2102 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
2103 DictionaryValue* infobar_item = new DictionaryValue; 2103 DictionaryValue* infobar_item = new DictionaryValue;
2104 InfoBarDelegate* infobar = infobar_service->GetInfoBarDelegateAt(i); 2104 InfoBarDelegate* infobar = infobar_service->infobar_at(i);
2105 switch (infobar->GetInfoBarAutomationType()) { 2105 switch (infobar->GetInfoBarAutomationType()) {
2106 case InfoBarDelegate::CONFIRM_INFOBAR: 2106 case InfoBarDelegate::CONFIRM_INFOBAR:
2107 infobar_item->SetString("type", "confirm_infobar"); 2107 infobar_item->SetString("type", "confirm_infobar");
2108 break; 2108 break;
2109 case InfoBarDelegate::ONE_CLICK_LOGIN_INFOBAR: 2109 case InfoBarDelegate::ONE_CLICK_LOGIN_INFOBAR:
2110 infobar_item->SetString("type", "oneclicklogin_infobar"); 2110 infobar_item->SetString("type", "oneclicklogin_infobar");
2111 break; 2111 break;
2112 case InfoBarDelegate::PASSWORD_INFOBAR: 2112 case InfoBarDelegate::PASSWORD_INFOBAR:
2113 infobar_item->SetString("type", "password_infobar"); 2113 infobar_item->SetString("type", "password_infobar");
2114 break; 2114 break;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 browser->tab_strip_model()->GetWebContentsAt(tab_index); 2174 browser->tab_strip_model()->GetWebContentsAt(tab_index);
2175 if (!web_contents) { 2175 if (!web_contents) {
2176 reply.SendError(base::StringPrintf("No such tab at index %d", tab_index)); 2176 reply.SendError(base::StringPrintf("No such tab at index %d", tab_index));
2177 return; 2177 return;
2178 } 2178 }
2179 InfoBarService* infobar_service = 2179 InfoBarService* infobar_service =
2180 InfoBarService::FromWebContents(web_contents); 2180 InfoBarService::FromWebContents(web_contents);
2181 2181
2182 InfoBarDelegate* infobar = NULL; 2182 InfoBarDelegate* infobar = NULL;
2183 size_t infobar_index = static_cast<size_t>(infobar_index_int); 2183 size_t infobar_index = static_cast<size_t>(infobar_index_int);
2184 if (infobar_index >= infobar_service->GetInfoBarCount()) { 2184 if (infobar_index >= infobar_service->infobar_count()) {
2185 reply.SendError(base::StringPrintf("No such infobar at index %" PRIuS, 2185 reply.SendError(base::StringPrintf("No such infobar at index %" PRIuS,
2186 infobar_index)); 2186 infobar_index));
2187 return; 2187 return;
2188 } 2188 }
2189 infobar = infobar_service->GetInfoBarDelegateAt(infobar_index); 2189 infobar = infobar_service->infobar_at(infobar_index);
2190 2190
2191 if ("dismiss" == action) { 2191 if ("dismiss" == action) {
2192 infobar->InfoBarDismissed(); 2192 infobar->InfoBarDismissed();
2193 infobar_service->RemoveInfoBar(infobar); 2193 infobar_service->RemoveInfoBar(infobar);
2194 reply.SendSuccess(NULL); 2194 reply.SendSuccess(NULL);
2195 return; 2195 return;
2196 } 2196 }
2197 if ("accept" == action || "cancel" == action) { 2197 if ("accept" == action || "cancel" == action) {
2198 ConfirmInfoBarDelegate* confirm_infobar; 2198 ConfirmInfoBarDelegate* confirm_infobar;
2199 if (!(confirm_infobar = infobar->AsConfirmInfoBarDelegate())) { 2199 if (!(confirm_infobar = infobar->AsConfirmInfoBarDelegate())) {
(...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after
5944 if (g_browser_process) 5944 if (g_browser_process)
5945 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5945 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5946 } 5946 }
5947 5947
5948 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5948 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5949 WebContents* tab) { 5949 WebContents* tab) {
5950 TabStripModel* tab_strip = browser->tab_strip_model(); 5950 TabStripModel* tab_strip = browser->tab_strip_model();
5951 if (tab_strip->GetActiveWebContents() != tab) 5951 if (tab_strip->GetActiveWebContents() != tab)
5952 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5952 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5953 } 5953 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698