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

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

Issue 12843009: Replace screen capture confirmation infobar with a message box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/screen_capture_confirmation_ui_infobar.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/api/infobars/infobar_service.h"
9 #include "chrome/browser/ui/screen_capture_infobar_delegate.h"
10
11 ScreenCaptureConfirmationUIInfobar::ScreenCaptureConfirmationUIInfobar(
12 content::WebContents* web_contents)
13 : infobar_service_(InfoBarService::FromWebContents(web_contents)),
14 delegate_(NULL) {
15 }
16
17 ScreenCaptureConfirmationUIInfobar::~ScreenCaptureConfirmationUIInfobar() {
18 if (delegate_)
19 infobar_service_->RemoveInfoBar(delegate_);
20 }
21
22 bool ScreenCaptureConfirmationUIInfobar::Show(
23 const ResultCallback& result_callback,
24 const string16& title) {
25 if (!infobar_service_)
26 return false;
27 result_callback_ = result_callback;
28 scoped_ptr<ScreenCaptureInfoBarDelegate> delegate(
29 new ScreenCaptureInfoBarDelegate(infobar_service_, title, this));
30 delegate_ = delegate.get();
31 infobar_service_->AddInfoBar(delegate.PassAs<InfoBarDelegate>());
32 return true;
33 }
34
35 void ScreenCaptureConfirmationUIInfobar::OnInfobarResult(bool allow) {
36 DCHECK(!result_callback_.is_null());
37
38 ScreenCaptureConfirmationUI::ResultCallback callback = result_callback_;
39 result_callback_.Reset();
40 delegate_ = NULL;
41 callback.Run(allow ? ALLOW : DENY);
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698