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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_browsertest.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 (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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
10 #include "chrome/browser/infobars/infobar.h" 10 #include "chrome/browser/infobars/infobar.h"
11 #include "chrome/browser/infobars/infobar_tab_helper.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/managed_mode/managed_mode.h" 12 #include "chrome/browser/managed_mode/managed_mode.h"
13 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" 13 #include "chrome/browser/managed_mode/managed_mode_interstitial.h"
14 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h" 14 #include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
15 #include "chrome/browser/managed_mode/managed_user_service.h" 15 #include "chrome/browser/managed_mode/managed_user_service.h"
16 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 16 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_navigator.h" 19 #include "chrome/browser/ui/browser_navigator.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" 21 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 bool IsAlreadyAddedInfobarPresent() { 125 bool IsAlreadyAddedInfobarPresent() {
126 return IsInfobarPresent(IDS_MANAGED_MODE_ALREADY_ADDED_MESSAGE); 126 return IsInfobarPresent(IDS_MANAGED_MODE_ALREADY_ADDED_MESSAGE);
127 } 127 }
128 128
129 // Checks whether the correct infobar is present. 129 // Checks whether the correct infobar is present.
130 bool IsInfobarPresent(int message_id) { 130 bool IsInfobarPresent(int message_id) {
131 InfoBarService* service = InfoBarService::FromWebContents( 131 InfoBarService* service = InfoBarService::FromWebContents(
132 browser()->tab_strip_model()->GetActiveWebContents()); 132 browser()->tab_strip_model()->GetActiveWebContents());
133 133
134 for (unsigned int i = 0; i < service->GetInfoBarCount(); ++i) { 134 for (size_t i = 0; i < service->infobar_count(); ++i) {
135 ConfirmInfoBarDelegate* delegate = 135 ConfirmInfoBarDelegate* delegate =
136 service->GetInfoBarDelegateAt(i)->AsConfirmInfoBarDelegate(); 136 service->infobar_at(i)->AsConfirmInfoBarDelegate();
137 if (delegate->GetMessageText() == l10n_util::GetStringUTF16(message_id)) 137 if (delegate->GetMessageText() == l10n_util::GetStringUTF16(message_id))
138 return true; 138 return true;
139 } 139 }
140 return false; 140 return false;
141 } 141 }
142 142
143 // Acts on the interstitial and infobar according to the values set to 143 // Acts on the interstitial and infobar according to the values set to
144 // |interstitial_action| and |infobar_action|. 144 // |interstitial_action| and |infobar_action|.
145 void ActOnInterstitialAndInfobar(WebContents* tab, 145 void ActOnInterstitialAndInfobar(WebContents* tab,
146 InterstitialAction interstitial_action, 146 InterstitialAction interstitial_action,
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // Simulate the click on the "preview" button. 620 // Simulate the click on the "preview" button.
621 delegate->CommandReceived("\"preview\""); 621 delegate->CommandReceived("\"preview\"");
622 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 622 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
623 WebContentsModalDialogManager::FromWebContents(tab); 623 WebContentsModalDialogManager::FromWebContents(tab);
624 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); 624 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog());
625 } 625 }
626 626
627 #endif // OS_CHROMEOS 627 #endif // OS_CHROMEOS
628 628
629 } // namespace 629 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698