| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ | 5 #ifndef COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ |
| 6 #define COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ | 6 #define COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 template <typename T> struct DefaultSingletonTraits; | 13 template <typename T> struct DefaultSingletonTraits; |
| 14 } |
| 13 | 15 |
| 14 namespace app_modal { | 16 namespace app_modal { |
| 15 | 17 |
| 16 class AppModalDialog; | 18 class AppModalDialog; |
| 17 | 19 |
| 18 // Keeps a queue of AppModalDialogs, making sure only one app modal | 20 // Keeps a queue of AppModalDialogs, making sure only one app modal |
| 19 // dialog is shown at a time. | 21 // dialog is shown at a time. |
| 20 // This class is a singleton. | 22 // This class is a singleton. |
| 21 class AppModalDialogQueue { | 23 class AppModalDialogQueue { |
| 22 public: | 24 public: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 52 bool HasActiveDialog() const; | 54 bool HasActiveDialog() const; |
| 53 | 55 |
| 54 AppModalDialog* active_dialog() { return active_dialog_; } | 56 AppModalDialog* active_dialog() { return active_dialog_; } |
| 55 | 57 |
| 56 // Iterators to walk the queue. The queue does not include the currently | 58 // Iterators to walk the queue. The queue does not include the currently |
| 57 // active app modal dialog box. | 59 // active app modal dialog box. |
| 58 iterator begin() { return app_modal_dialog_queue_.begin(); } | 60 iterator begin() { return app_modal_dialog_queue_.begin(); } |
| 59 iterator end() { return app_modal_dialog_queue_.end(); } | 61 iterator end() { return app_modal_dialog_queue_.end(); } |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 friend struct DefaultSingletonTraits<AppModalDialogQueue>; | 64 friend struct base::DefaultSingletonTraits<AppModalDialogQueue>; |
| 63 | 65 |
| 64 AppModalDialogQueue(); | 66 AppModalDialogQueue(); |
| 65 ~AppModalDialogQueue(); | 67 ~AppModalDialogQueue(); |
| 66 | 68 |
| 67 // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. | 69 // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. |
| 68 void ShowModalDialog(AppModalDialog* dialog); | 70 void ShowModalDialog(AppModalDialog* dialog); |
| 69 | 71 |
| 70 // Returns the next dialog to show. This removes entries from | 72 // Returns the next dialog to show. This removes entries from |
| 71 // app_modal_dialog_queue_ until one is valid or the queue is empty. This | 73 // app_modal_dialog_queue_ until one is valid or the queue is empty. This |
| 72 // returns NULL if there are no more dialogs, or all the dialogs in the queue | 74 // returns NULL if there are no more dialogs, or all the dialogs in the queue |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 // Stores if |ShowModalDialog()| is currently being called on an app-modal | 86 // Stores if |ShowModalDialog()| is currently being called on an app-modal |
| 85 // dialog. | 87 // dialog. |
| 86 bool showing_modal_dialog_; | 88 bool showing_modal_dialog_; |
| 87 | 89 |
| 88 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); | 90 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 } // namespace app_modal | 93 } // namespace app_modal |
| 92 | 94 |
| 93 #endif // COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ | 95 #endif // COMPONENTS_APP_MODAL_APP_MODAL_DIALOG_QUEUE_H_ |
| OLD | NEW |