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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/screen_capture_confirmation_ui_infobar.cc
diff --git a/chrome/browser/ui/screen_capture_confirmation_ui_infobar.cc b/chrome/browser/ui/screen_capture_confirmation_ui_infobar.cc
new file mode 100644
index 0000000000000000000000000000000000000000..da09be682b01ded253edf89d2300b2727ed30ee8
--- /dev/null
+++ b/chrome/browser/ui/screen_capture_confirmation_ui_infobar.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/screen_capture_confirmation_ui_infobar.h"
+
+#include "base/logging.h"
+#include "chrome/browser/api/infobars/infobar_service.h"
+#include "chrome/browser/ui/screen_capture_infobar_delegate.h"
+
+ScreenCaptureConfirmationUIInfobar::ScreenCaptureConfirmationUIInfobar(
+ content::WebContents* web_contents)
+ : 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.
+ delegate_(NULL) {
+}
+
+ScreenCaptureConfirmationUIInfobar::~ScreenCaptureConfirmationUIInfobar() {
+ if (delegate_)
+ infobar_service_->RemoveInfoBar(delegate_);
+}
+
+bool ScreenCaptureConfirmationUIInfobar::Show(
+ const ResultCallback& result_callback,
+ const string16& application_name) {
+ if (!infobar_service_)
+ return false;
+ result_callback_ = result_callback;
+ scoped_ptr<ScreenCaptureInfoBarDelegate> delegate(
+ new ScreenCaptureInfoBarDelegate(infobar_service_, application_name,
+ this));
+ delegate_ = delegate.get();
+ infobar_service_->AddInfoBar(delegate.PassAs<InfoBarDelegate>());
+ return true;
+}
+
+void ScreenCaptureConfirmationUIInfobar::OnInfobarResult(bool allow) {
+ DCHECK(!result_callback_.is_null());
+
+ ScreenCaptureConfirmationUI::ResultCallback callback = result_callback_;
+ result_callback_.Reset();
+ delegate_ = NULL;
+ callback.Run(allow ? ALLOW : DENY);
+}

Powered by Google App Engine
This is Rietveld 408576698