| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class GURL; | 28 class GURL; |
| 29 class SkRegion; | 29 class SkRegion; |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class DictionaryValue; | 32 class DictionaryValue; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 class BrowserContext; | 36 class BrowserContext; |
| 37 class RenderFrameHost; |
| 37 class WebContents; | 38 class WebContents; |
| 38 } | 39 } |
| 39 | 40 |
| 40 namespace extensions { | 41 namespace extensions { |
| 41 | 42 |
| 42 class AppDelegate; | 43 class AppDelegate; |
| 43 class AppWebContentsHelper; | 44 class AppWebContentsHelper; |
| 44 class Extension; | 45 class Extension; |
| 45 class NativeAppWindow; | 46 class NativeAppWindow; |
| 46 class PlatformAppBrowserTest; | 47 class PlatformAppBrowserTest; |
| 47 | 48 |
| 48 struct DraggableRegion; | 49 struct DraggableRegion; |
| 49 | 50 |
| 50 // Manages the web contents for app windows. The implementation for this | 51 // Manages the web contents for app windows. The implementation for this |
| 51 // class should create and maintain the WebContents for the window, and handle | 52 // class should create and maintain the WebContents for the window, and handle |
| 52 // any message passing between the web contents and the extension system or | 53 // any message passing between the web contents and the extension system or |
| 53 // native window. | 54 // native window. |
| 54 class AppWindowContents { | 55 class AppWindowContents { |
| 55 public: | 56 public: |
| 56 AppWindowContents() {} | 57 AppWindowContents() {} |
| 57 virtual ~AppWindowContents() {} | 58 virtual ~AppWindowContents() {} |
| 58 | 59 |
| 59 // Called to initialize the WebContents, before the app window is created. | 60 // Called to initialize the WebContents, before the app window is created. |
| 60 virtual void Initialize(content::BrowserContext* context, | 61 virtual void Initialize(content::BrowserContext* context, |
| 62 content::RenderFrameHost* creator_frame, |
| 61 const GURL& url) = 0; | 63 const GURL& url) = 0; |
| 62 | 64 |
| 63 // Called to load the contents, after the app window is created. | 65 // Called to load the contents, after the app window is created. |
| 64 virtual void LoadContents(int32_t creator_process_id) = 0; | 66 virtual void LoadContents(int32_t creator_process_id) = 0; |
| 65 | 67 |
| 66 // Called when the native window changes. | 68 // Called when the native window changes. |
| 67 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) = 0; | 69 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) = 0; |
| 68 | 70 |
| 69 // Called when the native window closes. | 71 // Called when the native window closes. |
| 70 virtual void NativeWindowClosed() = 0; | 72 virtual void NativeWindowClosed() = 0; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Normally AppWindow::Create should be used. | 213 // Normally AppWindow::Create should be used. |
| 212 // Takes ownership of |app_delegate| and |delegate|. | 214 // Takes ownership of |app_delegate| and |delegate|. |
| 213 AppWindow(content::BrowserContext* context, | 215 AppWindow(content::BrowserContext* context, |
| 214 AppDelegate* app_delegate, | 216 AppDelegate* app_delegate, |
| 215 const Extension* extension); | 217 const Extension* extension); |
| 216 | 218 |
| 217 // Initializes the render interface, web contents, and native window. | 219 // Initializes the render interface, web contents, and native window. |
| 218 // |app_window_contents| will become owned by AppWindow. | 220 // |app_window_contents| will become owned by AppWindow. |
| 219 void Init(const GURL& url, | 221 void Init(const GURL& url, |
| 220 AppWindowContents* app_window_contents, | 222 AppWindowContents* app_window_contents, |
| 223 content::RenderFrameHost* creator_frame, |
| 221 const CreateParams& params); | 224 const CreateParams& params); |
| 222 | 225 |
| 223 const std::string& window_key() const { return window_key_; } | 226 const std::string& window_key() const { return window_key_; } |
| 224 const SessionID& session_id() const { return session_id_; } | 227 const SessionID& session_id() const { return session_id_; } |
| 225 const std::string& extension_id() const { return extension_id_; } | 228 const std::string& extension_id() const { return extension_id_; } |
| 226 content::WebContents* web_contents() const; | 229 content::WebContents* web_contents() const; |
| 227 WindowType window_type() const { return window_type_; } | 230 WindowType window_type() const { return window_type_; } |
| 228 bool window_type_is_panel() const { | 231 bool window_type_is_panel() const { |
| 229 return (window_type_ == WINDOW_TYPE_PANEL || | 232 return (window_type_ == WINDOW_TYPE_PANEL || |
| 230 window_type_ == WINDOW_TYPE_V1_PANEL); | 233 window_type_ == WINDOW_TYPE_V1_PANEL); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 base::Closure on_first_commit_callback_; | 569 base::Closure on_first_commit_callback_; |
| 567 | 570 |
| 568 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; | 571 base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_; |
| 569 | 572 |
| 570 DISALLOW_COPY_AND_ASSIGN(AppWindow); | 573 DISALLOW_COPY_AND_ASSIGN(AppWindow); |
| 571 }; | 574 }; |
| 572 | 575 |
| 573 } // namespace extensions | 576 } // namespace extensions |
| 574 | 577 |
| 575 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ | 578 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ |
| OLD | NEW |