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

Side by Side Diff: chrome/browser/media/media_stream_infobar_delegate.cc

Issue 812823002: Remove dependency of infobars component on the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on Android Created 6 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
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/media/media_stream_infobar_delegate.h" 5 #include "chrome/browser/media/media_stream_infobar_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 InfoBarService* infobar_service = 46 InfoBarService* infobar_service =
47 InfoBarService::FromWebContents(web_contents); 47 InfoBarService::FromWebContents(web_contents);
48 if (!infobar_service) { 48 if (!infobar_service) {
49 // Deny the request if there is no place to show the infobar, e.g. when 49 // Deny the request if there is no place to show the infobar, e.g. when
50 // the request comes from a background extension page. 50 // the request comes from a background extension page.
51 controller->Deny(false, content::MEDIA_DEVICE_INVALID_STATE); 51 controller->Deny(false, content::MEDIA_DEVICE_INVALID_STATE);
52 return false; 52 return false;
53 } 53 }
54 54
55 scoped_ptr<infobars::InfoBar> infobar( 55 scoped_ptr<infobars::InfoBar> infobar(
56 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 56 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
57 new MediaStreamInfoBarDelegate(controller.Pass())))); 57 new MediaStreamInfoBarDelegate(controller.Pass()))));
58 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { 58 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
59 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); 59 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i);
60 if (old_infobar->delegate()->AsMediaStreamInfoBarDelegate()) { 60 if (old_infobar->delegate()->AsMediaStreamInfoBarDelegate()) {
61 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass()); 61 infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass());
62 return true; 62 return true;
63 } 63 }
64 } 64 }
65 infobar_service->AddInfoBar(infobar.Pass()); 65 infobar_service->AddInfoBar(infobar.Pass());
66 return true; 66 return true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 WindowOpenDisposition disposition) { 141 WindowOpenDisposition disposition) {
142 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( 142 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
143 content::OpenURLParams( 143 content::OpenURLParams(
144 GURL(chrome::kMediaAccessLearnMoreUrl), 144 GURL(chrome::kMediaAccessLearnMoreUrl),
145 content::Referrer(), 145 content::Referrer(),
146 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 146 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
147 ui::PAGE_TRANSITION_LINK, false)); 147 ui::PAGE_TRANSITION_LINK, false));
148 148
149 return false; // Do not dismiss the info bar. 149 return false; // Do not dismiss the info bar.
150 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/simple_alert_infobar_delegate.cc ('k') | chrome/browser/media/midi_permission_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698