Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_dialog.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "chrome/browser/ui/simple_message_box.h" | |
| 9 #include "content/public/browser/browser_thread.h" | |
| 10 #include "grit/generated_resources.h" | |
| 11 #include "ui/base/l10n/l10n_util.h" | |
| 12 | |
| 13 ScreenCaptureConfirmationDialog::ScreenCaptureConfirmationDialog() | |
| 14 : weak_factory_(this) { | |
| 15 } | |
| 16 | |
| 17 ScreenCaptureConfirmationDialog::~ScreenCaptureConfirmationDialog() { | |
| 18 } | |
| 19 | |
| 20 bool ScreenCaptureConfirmationDialog::Show( | |
| 21 const ResultCallback& result_callback, | |
| 22 const string16& application_name) { | |
| 23 result_callback_ = result_callback; | |
| 24 application_name_ = application_name; | |
|
Peter Kasting
2013/03/22 22:48:30
If you pass these to ShowMessageBox(), you need no
Sergey Ulanov
2013/03/22 23:26:09
Done.
| |
| 25 content::BrowserThread::PostTask( | |
| 26 content::BrowserThread::UI, FROM_HERE, | |
| 27 base::Bind(&ScreenCaptureConfirmationDialog::ShowMessageBox, | |
| 28 weak_factory_.GetWeakPtr())); | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 void ScreenCaptureConfirmationDialog::ShowMessageBox() { | |
| 33 chrome::MessageBoxResult result = chrome::ShowMessageBox( | |
| 34 NULL, | |
| 35 l10n_util::GetStringFUTF16(IDS_MEDIA_SCREEN_CAPTURE_CONFIRMATION_TITLE, | |
| 36 application_name_), | |
| 37 l10n_util::GetStringFUTF16(IDS_MEDIA_SCREEN_CAPTURE_CONFIRMATION_TEXT, | |
| 38 application_name_), | |
| 39 chrome::MESSAGE_BOX_TYPE_QUESTION); | |
| 40 ResultCallback callback = result_callback_; | |
| 41 result_callback_.Reset(); | |
| 42 callback.Run(result == chrome::MESSAGE_BOX_RESULT_YES ? ALLOW : DENY); | |
| 43 } | |
| OLD | NEW |