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

Side by Side Diff: components/web_modal/web_contents_modal_dialog_manager.h

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 5 #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 6 #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 29 matching lines...) Expand all
40 // bubble clients. 40 // bubble clients.
41 void ShowDialogWithManager( 41 void ShowDialogWithManager(
42 NativeWebContentsModalDialog dialog, 42 NativeWebContentsModalDialog dialog,
43 scoped_ptr<SingleWebContentsDialogManager> manager); 43 scoped_ptr<SingleWebContentsDialogManager> manager);
44 44
45 // Returns true if any dialogs are active and not closed. 45 // Returns true if any dialogs are active and not closed.
46 bool IsDialogActive() const; 46 bool IsDialogActive() const;
47 47
48 // Focus the topmost modal dialog. IsDialogActive() must be true when calling 48 // Focus the topmost modal dialog. IsDialogActive() must be true when calling
49 // this function. 49 // this function.
50 void FocusTopmostDialog(); 50 void FocusTopmostDialog() const;
51 51
52 // Overriden from SingleWebContentsDialogManagerDelegate: 52 // SingleWebContentsDialogManagerDelegate:
53 virtual content::WebContents* GetWebContents() const OVERRIDE; 53 virtual content::WebContents* GetWebContents() const OVERRIDE;
54 // Called when a WebContentsModalDialogs we own is about to be closed.
55 virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE; 54 virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE;
56 55
57 // For testing. 56 // For testing.
58 class TestApi { 57 class TestApi {
59 public: 58 public:
60 explicit TestApi(WebContentsModalDialogManager* manager) 59 explicit TestApi(WebContentsModalDialogManager* manager)
61 : manager_(manager) {} 60 : manager_(manager) {}
62 61
63 void CloseAllDialogs() { manager_->CloseAllDialogs(); } 62 void CloseAllDialogs() { manager_->CloseAllDialogs(); }
64 void DidAttachInterstitialPage() { manager_->DidAttachInterstitialPage(); } 63 void DidAttachInterstitialPage() { manager_->DidAttachInterstitialPage(); }
65 void WebContentsWasShown() { manager_->WasShown(); } 64 void WebContentsWasShown() { manager_->WasShown(); }
66 void WebContentsWasHidden() { manager_->WasHidden(); } 65 void WebContentsWasHidden() { manager_->WasHidden(); }
67 66
68 private: 67 private:
69 WebContentsModalDialogManager* manager_; 68 WebContentsModalDialogManager* manager_;
70 69
71 DISALLOW_COPY_AND_ASSIGN(TestApi); 70 DISALLOW_COPY_AND_ASSIGN(TestApi);
72 }; 71 };
73 72
74 private: 73 private:
75 explicit WebContentsModalDialogManager(content::WebContents* web_contents); 74 explicit WebContentsModalDialogManager(content::WebContents* web_contents);
76 friend class content::WebContentsUserData<WebContentsModalDialogManager>; 75 friend class content::WebContentsUserData<WebContentsModalDialogManager>;
76 friend class PopupManager;
77 77
78 struct DialogState { 78 struct DialogState {
79 DialogState(NativeWebContentsModalDialog dialog, 79 DialogState(NativeWebContentsModalDialog dialog,
80 scoped_ptr<SingleWebContentsDialogManager> manager); 80 scoped_ptr<SingleWebContentsDialogManager> manager);
81 ~DialogState(); 81 ~DialogState();
82 82
83 NativeWebContentsModalDialog dialog; 83 NativeWebContentsModalDialog dialog;
84 scoped_ptr<SingleWebContentsDialogManager> manager; 84 scoped_ptr<SingleWebContentsDialogManager> manager;
85 }; 85 };
86 86
(...skipping 29 matching lines...) Expand all
116 116
117 // True while closing the dialogs on WebContents close. 117 // True while closing the dialogs on WebContents close.
118 bool closing_all_dialogs_; 118 bool closing_all_dialogs_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager); 120 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager);
121 }; 121 };
122 122
123 } // namespace web_modal 123 } // namespace web_modal
124 124
125 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 125 #endif // COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
OLDNEW
« no previous file with comments | « components/web_modal/single_popup_manager.h ('k') | components/web_modal/web_contents_modal_dialog_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698