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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_browsertest.cc

Issue 13846007: Allow showing pending URL for new tab navigations, but only if safe. (Closed) Base URL: svn://svn.chromium.org/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"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr(); 168 content::Details<InfoBarAddedDetails>(infobar_added.details()).ptr();
169 ConfirmInfoBarDelegate* confirm_info_bar_delegate = 169 ConfirmInfoBarDelegate* confirm_info_bar_delegate =
170 info_bar_delegate->AsConfirmInfoBarDelegate(); 170 info_bar_delegate->AsConfirmInfoBarDelegate();
171 ASSERT_TRUE(confirm_info_bar_delegate); 171 ASSERT_TRUE(confirm_info_bar_delegate);
172 172
173 content::WindowedNotificationObserver infobar_removed( 173 content::WindowedNotificationObserver infobar_removed(
174 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, 174 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
175 content::NotificationService::AllSources()); 175 content::NotificationService::AllSources());
176 InfoBarService* infobar_service = 176 InfoBarService* infobar_service =
177 InfoBarService::FromWebContents(tab); 177 InfoBarService::FromWebContents(tab);
178 content::WindowedNotificationObserver back_observer(
179 content::NOTIFICATION_LOAD_STOP,
180 content::Source<NavigationController>(&tab->GetController()));
178 181
179 switch (infobar_action) { 182 switch (infobar_action) {
180 case INFOBAR_ACCEPT: 183 case INFOBAR_ACCEPT:
181 confirm_info_bar_delegate->InfoBarDismissed(); 184 confirm_info_bar_delegate->InfoBarDismissed();
182 ASSERT_TRUE(confirm_info_bar_delegate->Accept()); 185 ASSERT_TRUE(confirm_info_bar_delegate->Accept());
183 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); 186 infobar_service->RemoveInfoBar(confirm_info_bar_delegate);
184 break; 187 break;
185 case INFOBAR_CANCEL: 188 case INFOBAR_CANCEL:
186 confirm_info_bar_delegate->InfoBarDismissed(); 189 confirm_info_bar_delegate->InfoBarDismissed();
187 ASSERT_FALSE(confirm_info_bar_delegate->Cancel()); 190 ASSERT_FALSE(confirm_info_bar_delegate->Cancel());
191 back_observer.Wait();
188 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); 192 infobar_service->RemoveInfoBar(confirm_info_bar_delegate);
189 break; 193 break;
190 case INFOBAR_ALREADY_ADDED: 194 case INFOBAR_ALREADY_ADDED:
191 confirm_info_bar_delegate->InfoBarDismissed(); 195 confirm_info_bar_delegate->InfoBarDismissed();
192 infobar_service->RemoveInfoBar(confirm_info_bar_delegate); 196 infobar_service->RemoveInfoBar(confirm_info_bar_delegate);
193 break; 197 break;
194 case INFOBAR_NOT_USED: 198 case INFOBAR_NOT_USED:
195 NOTREACHED(); 199 NOTREACHED();
196 break; 200 break;
197 } 201 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // Simulate the click on the "preview" button. 624 // Simulate the click on the "preview" button.
621 delegate->CommandReceived("\"preview\""); 625 delegate->CommandReceived("\"preview\"");
622 WebContentsModalDialogManager* web_contents_modal_dialog_manager = 626 WebContentsModalDialogManager* web_contents_modal_dialog_manager =
623 WebContentsModalDialogManager::FromWebContents(tab); 627 WebContentsModalDialogManager::FromWebContents(tab);
624 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog()); 628 EXPECT_TRUE(web_contents_modal_dialog_manager->IsShowingDialog());
625 } 629 }
626 630
627 #endif // OS_CHROMEOS 631 #endif // OS_CHROMEOS
628 632
629 } // namespace 633 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/external_extension_browsertest.cc ('k') | chrome/browser/ui/browser_navigator_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698