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

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)),
Nico 2013/03/22 18:39:55 nit: indent 2 more
Sergey Ulanov 2013/03/22 19:25:47 Done.
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& application_name) {
25 if (!infobar_service_)
26 return false;
27 result_callback_ = result_callback;
28 scoped_ptr<ScreenCaptureInfoBarDelegate> delegate(
29 new ScreenCaptureInfoBarDelegate(infobar_service_, application_name,
30 this));
31 delegate_ = delegate.get();
32 infobar_service_->AddInfoBar(delegate.PassAs<InfoBarDelegate>());
33 return true;
34 }
35
36 void ScreenCaptureConfirmationUIInfobar::OnInfobarResult(bool allow) {
37 DCHECK(!result_callback_.is_null());
38
39 ScreenCaptureConfirmationUI::ResultCallback callback = result_callback_;
40 result_callback_.Reset();
41 delegate_ = NULL;
42 callback.Run(allow ? ALLOW : DENY);
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698