diff options
-rw-r--r-- | chrome/browser/app_modal_dialog_queue.cc | 7 | ||||
-rw-r--r-- | chrome/browser/app_modal_dialog_queue.h | 14 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 5 | ||||
-rw-r--r-- | chrome/browser/browser_list.cc | 20 | ||||
-rw-r--r-- | chrome/browser/browser_list.h | 17 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 2 |
6 files changed, 22 insertions, 43 deletions
diff --git a/chrome/browser/app_modal_dialog_queue.cc b/chrome/browser/app_modal_dialog_queue.cc index 0bcceb0..6646bbc 100644 --- a/chrome/browser/app_modal_dialog_queue.cc +++ b/chrome/browser/app_modal_dialog_queue.cc @@ -9,6 +9,7 @@ // static std::queue<views::AppModalDialogDelegate*>* AppModalDialogQueue::app_modal_dialog_queue_ = NULL; +views::AppModalDialogDelegate* AppModalDialogQueue::active_dialog_ = NULL; // static void AppModalDialogQueue::AddDialog(views::AppModalDialogDelegate* dialog) { @@ -24,7 +25,7 @@ void AppModalDialogQueue::AddDialog(views::AppModalDialogDelegate* dialog) { // static void AppModalDialogQueue::ShowNextDialog() { app_modal_dialog_queue_->pop(); - BrowserList::SetShowingAppModalDialog(NULL); + active_dialog_ = NULL; if (!app_modal_dialog_queue_->empty()) { ShowModalDialog(app_modal_dialog_queue_->front()); } else { @@ -43,7 +44,5 @@ void AppModalDialogQueue::ActivateModalDialog() { void AppModalDialogQueue::ShowModalDialog( views::AppModalDialogDelegate* dialog) { dialog->ShowModalDialog(); - BrowserList::SetShowingAppModalDialog(dialog); + active_dialog_ = dialog; } - - diff --git a/chrome/browser/app_modal_dialog_queue.h b/chrome/browser/app_modal_dialog_queue.h index d1748a1..ff1b5f5 100644 --- a/chrome/browser/app_modal_dialog_queue.h +++ b/chrome/browser/app_modal_dialog_queue.h @@ -39,6 +39,16 @@ class AppModalDialogQueue { // this condition). static void ActivateModalDialog(); + // Returns true if there is currently an active app modal dialog box. + static bool HasActiveDialog() { + return active_dialog_ != NULL; + } + + // Accessor for |active_dialog_|. + static views::AppModalDialogDelegate* active_dialog() { + return active_dialog_; + } + private: // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. static void ShowModalDialog(views::AppModalDialogDelegate* dialog); @@ -47,6 +57,10 @@ class AppModalDialogQueue { // currently modal dialog at the front of the queue. static std::queue<views::AppModalDialogDelegate*>* app_modal_dialog_queue_; + + // The currently active app-modal dialog box's delegate. NULL if there is no + // active app-modal dialog box. + static views::AppModalDialogDelegate* active_dialog_; }; #endif // CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__ diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index c014b8f..36cec74 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -6,6 +6,7 @@ #include "base/path_service.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/app_modal_dialog_queue.h" #include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/automation/url_request_failed_dns_job.h" @@ -1086,7 +1087,7 @@ void AutomationProvider::GetBrowserWindowCount(const IPC::Message& message) { void AutomationProvider::GetShowingAppModalDialog(const IPC::Message& message) { views::AppModalDialogDelegate* dialog_delegate = - BrowserList::GetShowingAppModalDialog(); + AppModalDialogQueue::active_dialog(); Send(new AutomationMsg_ShowingAppModalDialogResponse( message.routing_id(), dialog_delegate != NULL, dialog_delegate ? dialog_delegate->GetDialogButtons() : @@ -1098,7 +1099,7 @@ void AutomationProvider::ClickAppModalDialogButton(const IPC::Message& message, bool success = false; views::AppModalDialogDelegate* dialog_delegate = - BrowserList::GetShowingAppModalDialog(); + AppModalDialogQueue::active_dialog(); if (dialog_delegate && (dialog_delegate->GetDialogButtons() & button) == button) { views::DialogClientView* client_view = diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index ea64570..90ccb56 100644 --- a/chrome/browser/browser_list.cc +++ b/chrome/browser/browser_list.cc @@ -159,26 +159,6 @@ bool BrowserList::HasBrowserWithProfile(Profile* profile) { } // static -views::AppModalDialogDelegate* BrowserList::app_modal_dialog_ = NULL; - -// static -void BrowserList::SetShowingAppModalDialog( - views::AppModalDialogDelegate* dialog) { - DCHECK(!(app_modal_dialog_ && dialog)); - app_modal_dialog_ = dialog; -} - -// static -views::AppModalDialogDelegate* BrowserList::GetShowingAppModalDialog() { - return app_modal_dialog_; -} - -// static -bool BrowserList::IsShowingAppModalDialog() { - return app_modal_dialog_ != NULL; -} - -// static BrowserList::list_type BrowserList::last_active_browsers_; // static diff --git a/chrome/browser/browser_list.h b/chrome/browser/browser_list.h index e7ec88e..72262a9 100644 --- a/chrome/browser/browser_list.h +++ b/chrome/browser/browser_list.h @@ -10,11 +10,6 @@ #include "chrome/browser/browser.h" -namespace views { -class AppModalDialogDelegate; -}; -class WebContents; - // Stores a list of all Browser objects. class BrowserList { public: @@ -69,14 +64,6 @@ class BrowserList { // Returns true if there is at least one Browser with the specified profile. static bool HasBrowserWithProfile(Profile* profile); - // Sets the passed dialog delegate as the currently showing dialog. - static void SetShowingAppModalDialog(views::AppModalDialogDelegate* dialog); - static views::AppModalDialogDelegate* GetShowingAppModalDialog(); - - // True if the last active browser is application modal, false otherwise. See - // SetIsShowingAppModalDialog for more details. - static bool IsShowingAppModalDialog(); - static const_iterator begin() { return browsers_.begin(); } @@ -119,11 +106,9 @@ class BrowserList { static list_type browsers_; static std::vector<Observer*> observers_; static list_type last_active_browsers_; - - // Set to the currently showing modal dialog delegate if any, NULL otherwise. - static views::AppModalDialogDelegate* app_modal_dialog_; }; +class WebContents; // Iterates through all web view hosts in all browser windows. Because the // renderers act asynchronously, getting a host through this interface does diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 9c28a59..9930cc1 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -250,7 +250,7 @@ void BrowserView::AddViewToDropList(views::View* view) { bool BrowserView::ActivateAppModalDialog() const { // If another browser is app modal, flash and activate the modal browser. - if (BrowserList::IsShowingAppModalDialog()) { + if (AppModalDialogQueue::HasActiveDialog()) { Browser* active_browser = BrowserList::GetLastActive(); if (active_browser && (browser_ != active_browser)) { active_browser->window()->FlashFrame(); |