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

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..062d2905595b1e29a5df60b04bf5083290cb6eab
--- /dev/null
+++ b/chrome/browser/ui/screen_capture_confirmation_ui_infobar.cc
@@ -0,0 +1,42 @@
+// 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)),
+ delegate_(NULL) {
+}
+
+ScreenCaptureConfirmationUIInfobar::~ScreenCaptureConfirmationUIInfobar() {
+ if (delegate_)
+ infobar_service_->RemoveInfoBar(delegate_);
+}
+
+bool ScreenCaptureConfirmationUIInfobar::Show(
+ const ResultCallback& result_callback,
+ const string16& title) {
+ if (!infobar_service_)
+ return false;
+ result_callback_ = result_callback;
+ scoped_ptr<ScreenCaptureInfoBarDelegate> delegate(
+ new ScreenCaptureInfoBarDelegate(infobar_service_, title, 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