| 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 APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 5 #ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/browser/web_contents_delegate.h" | 9 #include "content/public/browser/web_contents_delegate.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 11 #include "extensions/browser/extension_function_dispatcher.h" | 11 #include "extensions/browser/extension_function_dispatcher.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class BrowserContext; | 16 class BrowserContext; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace extensions { |
| 20 class AppDelegate; |
| 21 class AppWebContentsHelper; |
| 22 } |
| 23 |
| 19 namespace apps { | 24 namespace apps { |
| 20 | 25 |
| 21 class AppDelegate; | |
| 22 class AppWebContentsHelper; | |
| 23 | |
| 24 // Manages the web contents for extension-hosted launcher pages. The | 26 // Manages the web contents for extension-hosted launcher pages. The |
| 25 // implementation for this class should create and maintain the WebContents for | 27 // implementation for this class should create and maintain the WebContents for |
| 26 // the page, and handle any message passing between the web contents and the | 28 // the page, and handle any message passing between the web contents and the |
| 27 // extension system. | 29 // extension system. |
| 28 class CustomLauncherPageContents | 30 class CustomLauncherPageContents |
| 29 : public content::WebContentsDelegate, | 31 : public content::WebContentsDelegate, |
| 30 public content::WebContentsObserver, | 32 public content::WebContentsObserver, |
| 31 public extensions::ExtensionFunctionDispatcher::Delegate { | 33 public extensions::ExtensionFunctionDispatcher::Delegate { |
| 32 public: | 34 public: |
| 33 CustomLauncherPageContents(scoped_ptr<AppDelegate> app_delegate, | 35 CustomLauncherPageContents(scoped_ptr<extensions::AppDelegate> app_delegate, |
| 34 const std::string& extension_id); | 36 const std::string& extension_id); |
| 35 virtual ~CustomLauncherPageContents(); | 37 virtual ~CustomLauncherPageContents(); |
| 36 | 38 |
| 37 // Called to initialize and load the WebContents. | 39 // Called to initialize and load the WebContents. |
| 38 void Initialize(content::BrowserContext* context, const GURL& url); | 40 void Initialize(content::BrowserContext* context, const GURL& url); |
| 39 | 41 |
| 40 content::WebContents* web_contents() const { return web_contents_.get(); } | 42 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 41 | 43 |
| 42 // content::WebContentsDelegate overrides: | 44 // content::WebContentsDelegate overrides: |
| 43 virtual content::WebContents* OpenURLFromTab( | 45 virtual content::WebContents* OpenURLFromTab( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // extensions::ExtensionFunctionDispatcher::Delegate overrides: | 79 // extensions::ExtensionFunctionDispatcher::Delegate overrides: |
| 78 virtual extensions::WindowController* GetExtensionWindowController() | 80 virtual extensions::WindowController* GetExtensionWindowController() |
| 79 const OVERRIDE; | 81 const OVERRIDE; |
| 80 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 82 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 81 | 83 |
| 82 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 84 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 83 | 85 |
| 84 scoped_ptr<content::WebContents> web_contents_; | 86 scoped_ptr<content::WebContents> web_contents_; |
| 85 scoped_ptr<extensions::ExtensionFunctionDispatcher> | 87 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
| 86 extension_function_dispatcher_; | 88 extension_function_dispatcher_; |
| 87 scoped_ptr<AppDelegate> app_delegate_; | 89 scoped_ptr<extensions::AppDelegate> app_delegate_; |
| 88 scoped_ptr<AppWebContentsHelper> helper_; | 90 scoped_ptr<extensions::AppWebContentsHelper> helper_; |
| 89 | 91 |
| 90 std::string extension_id_; | 92 std::string extension_id_; |
| 91 | 93 |
| 92 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); | 94 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 } // namespace apps | 97 } // namespace apps |
| 96 | 98 |
| 97 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ | 99 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| OLD | NEW |