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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 909
910 content::RecordAction( 910 content::RecordAction(
911 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); 911 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
912 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 912 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
913 913
914 RegisterProtocolHandlerInfoBarDelegate* rph_delegate = 914 RegisterProtocolHandlerInfoBarDelegate* rph_delegate =
915 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper, 915 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper,
916 registry, 916 registry,
917 handler); 917 handler);
918 918
919 for (size_t i = 0; i < infobar_helper->infobar_count(); i++) { 919 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); i++) {
920 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); 920 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i);
921 RegisterProtocolHandlerInfoBarDelegate* cast_delegate = 921 RegisterProtocolHandlerInfoBarDelegate* cast_delegate =
922 delegate->AsRegisterProtocolHandlerInfoBarDelegate(); 922 delegate->AsRegisterProtocolHandlerInfoBarDelegate();
923 if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) { 923 if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) {
924 infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate); 924 infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate);
925 rph_delegate = NULL; 925 rph_delegate = NULL;
926 break; 926 break;
927 } 927 }
928 } 928 }
929 929
(...skipping 26 matching lines...) Expand all
956 const content::MediaResponseCallback& callback) { 956 const content::MediaResponseCallback& callback) {
957 TabContents* tab = TabContents::FromWebContents(web_contents); 957 TabContents* tab = TabContents::FromWebContents(web_contents);
958 958
959 scoped_ptr<MediaStreamDevicesController> 959 scoped_ptr<MediaStreamDevicesController>
960 controller(new MediaStreamDevicesController(tab->profile(), 960 controller(new MediaStreamDevicesController(tab->profile(),
961 request, 961 request,
962 callback)); 962 callback));
963 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { 963 if (!controller->DismissInfoBarAndTakeActionOnSettings()) {
964 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); 964 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
965 InfoBarDelegate* old_infobar = NULL; 965 InfoBarDelegate* old_infobar = NULL;
966 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 966 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) {
967 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> 967 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)->
968 AsMediaStreamInfoBarDelegate(); 968 AsMediaStreamInfoBarDelegate();
969 if (old_infobar) 969 if (old_infobar)
970 break; 970 break;
971 } 971 }
972 972
973 InfoBarDelegate* infobar = 973 InfoBarDelegate* infobar =
974 new MediaStreamInfoBarDelegate(infobar_helper, controller.release()); 974 new MediaStreamInfoBarDelegate(infobar_helper, controller.release());
975 if (old_infobar) 975 if (old_infobar)
976 infobar_helper->ReplaceInfoBar(old_infobar, infobar); 976 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 if (contents && !allow_js_access) { 2319 if (contents && !allow_js_access) {
2320 contents->web_contents()->GetController().LoadURL( 2320 contents->web_contents()->GetController().LoadURL(
2321 target_url, 2321 target_url,
2322 content::Referrer(), 2322 content::Referrer(),
2323 content::PAGE_TRANSITION_LINK, 2323 content::PAGE_TRANSITION_LINK,
2324 std::string()); // No extra headers. 2324 std::string()); // No extra headers.
2325 } 2325 }
2326 2326
2327 return contents != NULL; 2327 return contents != NULL;
2328 } 2328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698