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

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: Respond to review comments, merge to LKGR 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 908
909 content::RecordAction( 909 content::RecordAction(
910 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); 910 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
911 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 911 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
912 912
913 RegisterProtocolHandlerInfoBarDelegate* rph_delegate = 913 RegisterProtocolHandlerInfoBarDelegate* rph_delegate =
914 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper, 914 new RegisterProtocolHandlerInfoBarDelegate(infobar_helper,
915 registry, 915 registry,
916 handler); 916 handler);
917 917
918 for (size_t i = 0; i < infobar_helper->infobar_count(); i++) { 918 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); i++) {
919 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); 919 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i);
920 RegisterProtocolHandlerInfoBarDelegate* cast_delegate = 920 RegisterProtocolHandlerInfoBarDelegate* cast_delegate =
921 delegate->AsRegisterProtocolHandlerInfoBarDelegate(); 921 delegate->AsRegisterProtocolHandlerInfoBarDelegate();
922 if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) { 922 if (cast_delegate != NULL && cast_delegate->IsReplacedBy(rph_delegate)) {
923 infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate); 923 infobar_helper->ReplaceInfoBar(cast_delegate, rph_delegate);
924 rph_delegate = NULL; 924 rph_delegate = NULL;
925 break; 925 break;
926 } 926 }
927 } 927 }
928 928
(...skipping 26 matching lines...) Expand all
955 const content::MediaResponseCallback& callback) { 955 const content::MediaResponseCallback& callback) {
956 TabContents* tab = TabContents::FromWebContents(web_contents); 956 TabContents* tab = TabContents::FromWebContents(web_contents);
957 957
958 scoped_ptr<MediaStreamDevicesController> 958 scoped_ptr<MediaStreamDevicesController>
959 controller(new MediaStreamDevicesController(tab->profile(), 959 controller(new MediaStreamDevicesController(tab->profile(),
960 request, 960 request,
961 callback)); 961 callback));
962 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { 962 if (!controller->DismissInfoBarAndTakeActionOnSettings()) {
963 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); 963 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
964 InfoBarDelegate* old_infobar = NULL; 964 InfoBarDelegate* old_infobar = NULL;
965 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 965 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) {
966 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> 966 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)->
967 AsMediaStreamInfoBarDelegate(); 967 AsMediaStreamInfoBarDelegate();
968 if (old_infobar) 968 if (old_infobar)
969 break; 969 break;
970 } 970 }
971 971
972 InfoBarDelegate* infobar = 972 InfoBarDelegate* infobar =
973 new MediaStreamInfoBarDelegate(infobar_helper, controller.release()); 973 new MediaStreamInfoBarDelegate(infobar_helper, controller.release());
974 if (old_infobar) 974 if (old_infobar)
975 infobar_helper->ReplaceInfoBar(old_infobar, infobar); 975 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 if (contents && !allow_js_access) { 2318 if (contents && !allow_js_access) {
2319 contents->web_contents()->GetController().LoadURL( 2319 contents->web_contents()->GetController().LoadURL(
2320 target_url, 2320 target_url,
2321 content::Referrer(), 2321 content::Referrer(),
2322 content::PAGE_TRANSITION_LINK, 2322 content::PAGE_TRANSITION_LINK,
2323 std::string()); // No extra headers. 2323 std::string()); // No extra headers.
2324 } 2324 }
2325 2325
2326 return contents != NULL; 2326 return contents != NULL;
2327 } 2327 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698