| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ |
| 7 | 7 |
| 8 #include <set> |
| 9 |
| 8 #include "chrome/common/page_transition_types.h" | 10 #include "chrome/common/page_transition_types.h" |
| 9 #include "webkit/glue/window_open_disposition.h" | 11 #include "webkit/glue/window_open_disposition.h" |
| 10 | 12 |
| 11 // The different platform specific subclasses use different delegates for their | 13 // The different platform specific subclasses use different delegates for their |
| 12 // dialogs. | 14 // dialogs. |
| 13 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 14 namespace views { | 16 namespace views { |
| 15 class WindowDelegate; | 17 class WindowDelegate; |
| 16 } | 18 } |
| 17 typedef views::WindowDelegate ConstrainedWindowDelegate; | 19 typedef views::WindowDelegate ConstrainedWindowDelegate; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 public: | 37 public: |
| 36 // Create a Constrained Window that contains a platform specific client | 38 // Create a Constrained Window that contains a platform specific client |
| 37 // area. Typical uses include the HTTP Basic Auth prompt. The caller must | 39 // area. Typical uses include the HTTP Basic Auth prompt. The caller must |
| 38 // provide a delegate to describe the content area and to respond to events. | 40 // provide a delegate to describe the content area and to respond to events. |
| 39 static ConstrainedWindow* CreateConstrainedDialog( | 41 static ConstrainedWindow* CreateConstrainedDialog( |
| 40 TabContents* owner, | 42 TabContents* owner, |
| 41 ConstrainedWindowDelegate* delegate); | 43 ConstrainedWindowDelegate* delegate); |
| 42 | 44 |
| 43 // Closes the Constrained Window. | 45 // Closes the Constrained Window. |
| 44 virtual void CloseConstrainedWindow() = 0; | 46 virtual void CloseConstrainedWindow() = 0; |
| 47 |
| 48 // Events which constrained windows may recognize. |
| 49 enum Event { |
| 50 kEventNavigate, |
| 51 }; |
| 52 |
| 53 // Inform the constrained the window that its parent tab will do something. |
| 54 // Returns |true| if it did something in response, |false| if not. The default |
| 55 // implementation, appropriate for "content-area" constrained windows, does |
| 56 // the following: |
| 57 // - |kEventNavigate|: calls |CloseConstrainedWindow()|; |
| 58 // - anything/everything else: nothing. |
| 59 // Platforms which implement non-"content-area" constrained windows (e.g., |
| 60 // tab-modal open/close dialogs) should override this. |
| 61 virtual bool ParentWillDo(Event event); |
| 62 |
| 63 // The level of modality, in order of increasing modality (or in the |
| 64 // enumeration is important): |
| 65 // - kModalNone: no modality (not for use by constrained windows themselves |
| 66 // -- but for others when reporting the current modality level) |
| 67 // - kModalForContent: "content-modality" (toolbar, navigation, etc. remain |
| 68 // enabled) |
| 69 // - kModalForTab: full tab-modality (visual tab contents are all disabled) |
| 70 // - kModalForWindow: window-modality (reserved) |
| 71 // Things which are disabled for a given level of modality should also be |
| 72 // disabled for higher levels. |
| 73 // TODO(viettrungluu@gmail.com): These probably deserve a better (more |
| 74 // general) home than in the constrained window stuff. |
| 75 enum ModalityLevel { |
| 76 kModalNone = 0, |
| 77 kModalForContent, |
| 78 kModalForTab, |
| 79 kModalForWindow |
| 80 }; |
| 81 |
| 82 // Gets the modality level of the constrained window (which should be static, |
| 83 // in that it should not vary over the lifetime of the window). The default |
| 84 // implementation produces only "content-modal" constrained windows. |
| 85 virtual ModalityLevel GetModalityLevel() { return kModalForContent; } |
| 45 }; | 86 }; |
| 46 | 87 |
| 47 #endif // CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ | 88 #endif // CHROME_BROWSER_TAB_CONTENTS_CONSTRAINED_WINDOW_H_ |
| OLD | NEW |