OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "components/sessions/session_id.h" | 13 #include "components/sessions/session_id.h" |
14 #include "components/web_modal/popup_manager.h" | 14 #include "components/web_modal/popup_manager.h" |
15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
16 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "extensions/browser/extension_function_dispatcher.h" |
18 #include "extensions/browser/extension_icon_image.h" | 19 #include "extensions/browser/extension_icon_image.h" |
19 #include "extensions/browser/extension_registry_observer.h" | 20 #include "extensions/browser/extension_registry_observer.h" |
20 #include "ui/base/ui_base_types.h" // WindowShowState | 21 #include "ui/base/ui_base_types.h" // WindowShowState |
21 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
22 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
23 | 24 |
24 class GURL; | 25 class GURL; |
25 class SkRegion; | 26 class SkRegion; |
26 | 27 |
27 namespace base { | 28 namespace base { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) = 0; | 64 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) = 0; |
64 | 65 |
65 // Called when the native window closes. | 66 // Called when the native window closes. |
66 virtual void NativeWindowClosed() = 0; | 67 virtual void NativeWindowClosed() = 0; |
67 | 68 |
68 // Called in tests when the window is shown | 69 // Called in tests when the window is shown |
69 virtual void DispatchWindowShownForTests() const = 0; | 70 virtual void DispatchWindowShownForTests() const = 0; |
70 | 71 |
71 virtual content::WebContents* GetWebContents() const = 0; | 72 virtual content::WebContents* GetWebContents() const = 0; |
72 | 73 |
| 74 virtual extensions::WindowController* GetWindowController() const = 0; |
| 75 |
73 private: | 76 private: |
74 DISALLOW_COPY_AND_ASSIGN(AppWindowContents); | 77 DISALLOW_COPY_AND_ASSIGN(AppWindowContents); |
75 }; | 78 }; |
76 | 79 |
77 // AppWindow is the type of window used by platform apps. App windows | 80 // AppWindow is the type of window used by platform apps. App windows |
78 // have a WebContents but none of the chrome of normal browser windows. | 81 // have a WebContents but none of the chrome of normal browser windows. |
79 class AppWindow : public content::WebContentsDelegate, | 82 class AppWindow : public content::WebContentsDelegate, |
80 public content::WebContentsObserver, | 83 public content::WebContentsObserver, |
81 public web_modal::WebContentsModalDialogManagerDelegate, | 84 public web_modal::WebContentsModalDialogManagerDelegate, |
82 public IconImage::Observer, | 85 public IconImage::Observer, |
| 86 public ExtensionFunctionDispatcher::Delegate, |
83 public ExtensionRegistryObserver { | 87 public ExtensionRegistryObserver { |
84 public: | 88 public: |
85 enum WindowType { | 89 enum WindowType { |
86 WINDOW_TYPE_DEFAULT = 1 << 0, // Default app window. | 90 WINDOW_TYPE_DEFAULT = 1 << 0, // Default app window. |
87 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). | 91 WINDOW_TYPE_PANEL = 1 << 1, // OS controlled panel window (Ash only). |
88 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate | 92 WINDOW_TYPE_V1_PANEL = 1 << 2, // For apps v1 support in Ash; deprecate |
89 // with v1 apps. | 93 // with v1 apps. |
90 }; | 94 }; |
91 | 95 |
92 enum Frame { | 96 enum Frame { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void RequestToLockMouse(content::WebContents* web_contents, | 405 void RequestToLockMouse(content::WebContents* web_contents, |
402 bool user_gesture, | 406 bool user_gesture, |
403 bool last_unlocked_by_target) override; | 407 bool last_unlocked_by_target) override; |
404 bool PreHandleGestureEvent(content::WebContents* source, | 408 bool PreHandleGestureEvent(content::WebContents* source, |
405 const blink::WebGestureEvent& event) override; | 409 const blink::WebGestureEvent& event) override; |
406 | 410 |
407 // content::WebContentsObserver implementation. | 411 // content::WebContentsObserver implementation. |
408 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 412 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
409 void DidFirstVisuallyNonEmptyPaint() override; | 413 void DidFirstVisuallyNonEmptyPaint() override; |
410 | 414 |
| 415 // ExtensionFunctionDispatcher::Delegate implementation. |
| 416 WindowController* GetExtensionWindowController() const override; |
| 417 content::WebContents* GetAssociatedWebContents() const override; |
| 418 |
411 // ExtensionRegistryObserver implementation. | 419 // ExtensionRegistryObserver implementation. |
412 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 420 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
413 const Extension* extension, | 421 const Extension* extension, |
414 UnloadedExtensionInfo::Reason reason) override; | 422 UnloadedExtensionInfo::Reason reason) override; |
415 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, | 423 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, |
416 const Extension* extension, | 424 const Extension* extension, |
417 bool is_update, | 425 bool is_update, |
418 bool from_ephemeral, | 426 bool from_ephemeral, |
419 const std::string& old_name) override; | 427 const std::string& old_name) override; |
420 | 428 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 bool is_ime_window_; | 556 bool is_ime_window_; |
549 | 557 |
550 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; | 558 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; |
551 | 559 |
552 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 560 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
553 }; | 561 }; |
554 | 562 |
555 } // namespace extensions | 563 } // namespace extensions |
556 | 564 |
557 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 565 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
OLD | NEW |