Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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/modal_dialog_lock.h" | |
| 6 | |
| 7 #if defined(OS_WIN) | |
| 8 #include <Windows.h> | |
| 9 #endif | |
| 10 | |
| 11 #include "base/bind.h" | |
| 12 #include "base/command_line.h" | |
| 13 #include "base/files/file_path.h" | |
| 14 #include "base/logging.h" | |
| 15 | |
| 16 ModalDialogLock::ModalDialogLock( | |
| 17 const ProcessSingleton::NotificationCallback& original_callback) | |
| 18 : active_dialog_(NULL), | |
| 19 original_callback_(original_callback) {} | |
| 20 | |
| 21 ModalDialogLock::~ModalDialogLock() {} | |
| 22 | |
| 23 void ModalDialogLock::SetActiveModalDialog(gfx::NativeWindow active_dialog) { | |
| 24 #if !defined(OS_WIN) || defined(USE_AURA) | |
|
gab
2013/03/27 18:03:26
If this is only meant to be used on Windows, why n
gab
2013/03/27 18:03:26
Why is this a NOTREACHED() on win-Aura?
erikwright (departed)
2013/03/28 03:16:34
I didn't want to force too may #ifdef's in the cli
erikwright (departed)
2013/03/28 03:16:34
It was never actually called and eventually we wou
| |
| 25 NOTREACHED(); | |
|
gab
2013/03/27 18:03:26
nit: indent two less spaces.
erikwright (departed)
2013/03/28 03:16:34
n/a.
| |
| 26 #else | |
| 27 active_dialog_ = active_dialog; | |
| 28 #endif | |
| 29 } | |
| 30 | |
| 31 ProcessSingleton::NotificationCallback | |
| 32 ModalDialogLock::AsNotificationCallback() { | |
| 33 #if !defined(OS_WIN) || defined(USE_AURA) | |
| 34 return original_callback_; | |
| 35 #else | |
| 36 return base::Bind(&ModalDialogLock::NotificationCallbackImpl, | |
| 37 base::Unretained(this)); | |
| 38 #endif | |
| 39 } | |
| 40 | |
| 41 bool ModalDialogLock::NotificationCallbackImpl( | |
| 42 const CommandLine& command_line, | |
| 43 const base::FilePath& current_directory) { | |
| 44 if (active_dialog_ != NULL) { | |
| 45 #if !defined(OS_WIN) || defined(USE_AURA) | |
| 46 NOTREACHED(); | |
| 47 #else | |
| 48 ::SetForegroundWindow(active_dialog_); | |
| 49 #endif | |
| 50 return true; | |
| 51 } else { | |
| 52 return original_callback_.Run(command_line, current_directory); | |
| 53 } | |
| 54 } | |
| OLD | NEW |