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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/browser/extensions/extension_host.h" 56 #include "chrome/browser/extensions/extension_host.h"
57 #include "chrome/browser/extensions/extension_service.h" 57 #include "chrome/browser/extensions/extension_service.h"
58 #include "chrome/browser/extensions/extension_system.h" 58 #include "chrome/browser/extensions/extension_system.h"
59 #include "chrome/browser/extensions/extension_tab_util.h" 59 #include "chrome/browser/extensions/extension_tab_util.h"
60 #include "chrome/browser/extensions/extension_util.h" 60 #include "chrome/browser/extensions/extension_util.h"
61 #include "chrome/browser/extensions/unpacked_installer.h" 61 #include "chrome/browser/extensions/unpacked_installer.h"
62 #include "chrome/browser/extensions/updater/extension_updater.h" 62 #include "chrome/browser/extensions/updater/extension_updater.h"
63 #include "chrome/browser/history/history_service_factory.h" 63 #include "chrome/browser/history/history_service_factory.h"
64 #include "chrome/browser/history/top_sites.h" 64 #include "chrome/browser/history/top_sites.h"
65 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 65 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
66 #include "chrome/browser/infobars/infobar.h"
67 #include "chrome/browser/infobars/infobar_service.h" 66 #include "chrome/browser/infobars/infobar_service.h"
68 #include "chrome/browser/lifetime/application_lifetime.h" 67 #include "chrome/browser/lifetime/application_lifetime.h"
69 #include "chrome/browser/notifications/balloon.h" 68 #include "chrome/browser/notifications/balloon.h"
70 #include "chrome/browser/notifications/balloon_collection.h" 69 #include "chrome/browser/notifications/balloon_collection.h"
71 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" 70 #include "chrome/browser/notifications/balloon_notification_ui_manager.h"
72 #include "chrome/browser/notifications/notification.h" 71 #include "chrome/browser/notifications/notification.h"
73 #include "chrome/browser/password_manager/password_store.h" 72 #include "chrome/browser/password_manager/password_store.h"
74 #include "chrome/browser/password_manager/password_store_change.h" 73 #include "chrome/browser/password_manager/password_store_change.h"
75 #include "chrome/browser/password_manager/password_store_factory.h" 74 #include "chrome/browser/password_manager/password_store_factory.h"
76 #include "chrome/browser/platform_util.h" 75 #include "chrome/browser/platform_util.h"
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 browser->window()->SetBounds(rect); 1991 browser->window()->SetBounds(rect);
1993 AutomationJSONReply(this, reply_message).SendSuccess(NULL); 1992 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
1994 } 1993 }
1995 1994
1996 ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) { 1995 ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
1997 // Each infobar may have different properties depending on the type. 1996 // Each infobar may have different properties depending on the type.
1998 ListValue* infobars = new ListValue; 1997 ListValue* infobars = new ListValue;
1999 InfoBarService* infobar_service = InfoBarService::FromWebContents(wc); 1998 InfoBarService* infobar_service = InfoBarService::FromWebContents(wc);
2000 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 1999 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
2001 DictionaryValue* infobar_item = new DictionaryValue; 2000 DictionaryValue* infobar_item = new DictionaryValue;
2002 InfoBarDelegate* infobar = infobar_service->infobar_at(i)->delegate(); 2001 InfoBarDelegate* infobar = infobar_service->infobar_at(i);
2003 switch (infobar->GetInfoBarAutomationType()) { 2002 switch (infobar->GetInfoBarAutomationType()) {
2004 case InfoBarDelegate::CONFIRM_INFOBAR: 2003 case InfoBarDelegate::CONFIRM_INFOBAR:
2005 infobar_item->SetString("type", "confirm_infobar"); 2004 infobar_item->SetString("type", "confirm_infobar");
2006 break; 2005 break;
2007 case InfoBarDelegate::PASSWORD_INFOBAR: 2006 case InfoBarDelegate::PASSWORD_INFOBAR:
2008 infobar_item->SetString("type", "password_infobar"); 2007 infobar_item->SetString("type", "password_infobar");
2009 break; 2008 break;
2010 case InfoBarDelegate::RPH_INFOBAR: 2009 case InfoBarDelegate::RPH_INFOBAR:
2011 infobar_item->SetString("type", "rph_infobar"); 2010 infobar_item->SetString("type", "rph_infobar");
2012 break; 2011 break;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 return; 2072 return;
2074 } 2073 }
2075 2074
2076 InfoBarService* infobar_service = 2075 InfoBarService* infobar_service =
2077 InfoBarService::FromWebContents(web_contents); 2076 InfoBarService::FromWebContents(web_contents);
2078 if (infobar_index >= infobar_service->infobar_count()) { 2077 if (infobar_index >= infobar_service->infobar_count()) {
2079 reply.SendError(base::StringPrintf("No such infobar at index %" PRIuS, 2078 reply.SendError(base::StringPrintf("No such infobar at index %" PRIuS,
2080 infobar_index)); 2079 infobar_index));
2081 return; 2080 return;
2082 } 2081 }
2083 InfoBar* infobar = infobar_service->infobar_at(infobar_index); 2082 InfoBarDelegate* infobar_delegate =
2084 InfoBarDelegate* infobar_delegate = infobar->delegate(); 2083 infobar_service->infobar_at(infobar_index);
2085 2084
2086 if (action == "dismiss") { 2085 if (action == "dismiss") {
2087 infobar_delegate->InfoBarDismissed(); 2086 infobar_delegate->InfoBarDismissed();
2088 infobar_service->RemoveInfoBar(infobar); 2087 infobar_service->RemoveInfoBar(infobar_delegate);
2089 reply.SendSuccess(NULL); 2088 reply.SendSuccess(NULL);
2090 return; 2089 return;
2091 } 2090 }
2092 if ((action == "accept") || (action == "cancel")) { 2091 if ((action == "accept") || (action == "cancel")) {
2093 ConfirmInfoBarDelegate* confirm_infobar_delegate = 2092 ConfirmInfoBarDelegate* confirm_infobar_delegate =
2094 infobar_delegate->AsConfirmInfoBarDelegate(); 2093 infobar_delegate->AsConfirmInfoBarDelegate();
2095 if (!confirm_infobar_delegate) { 2094 if (!confirm_infobar_delegate) {
2096 reply.SendError("Not a confirm infobar"); 2095 reply.SendError("Not a confirm infobar");
2097 return; 2096 return;
2098 } 2097 }
2099 if ((action == "accept") ? 2098 if ((action == "accept") ?
2100 confirm_infobar_delegate->Accept() : confirm_infobar_delegate->Cancel()) 2099 confirm_infobar_delegate->Accept() : confirm_infobar_delegate->Cancel())
2101 infobar_service->RemoveInfoBar(infobar); 2100 infobar_service->RemoveInfoBar(infobar_delegate);
2102 reply.SendSuccess(NULL); 2101 reply.SendSuccess(NULL);
2103 return; 2102 return;
2104 } 2103 }
2105 2104
2106 reply.SendError("Invalid action"); 2105 reply.SendError("Invalid action");
2107 } 2106 }
2108 2107
2109 namespace { 2108 namespace {
2110 2109
2111 // Gets info about BrowserChildProcessHost. Must run on IO thread to 2110 // Gets info about BrowserChildProcessHost. Must run on IO thread to
(...skipping 3341 matching lines...) Expand 10 before | Expand all | Expand 10 after
5453 if (g_browser_process) 5452 if (g_browser_process)
5454 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
5455 } 5454 }
5456 5455
5457 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
5458 WebContents* tab) { 5457 WebContents* tab) {
5459 TabStripModel* tab_strip = browser->tab_strip_model(); 5458 TabStripModel* tab_strip = browser->tab_strip_model();
5460 if (tab_strip->GetActiveWebContents() != tab) 5459 if (tab_strip->GetActiveWebContents() != tab)
5461 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); 5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true);
5462 } 5461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698