OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 6 #define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "extensions/browser/extension_function_dispatcher.h" |
| 11 |
| 12 class GURL; |
| 13 |
| 14 namespace content { |
| 15 class BrowserContext; |
| 16 } |
| 17 |
| 18 namespace apps { |
| 19 |
| 20 // Manages the web contents for extension-hosted launcher pages. The |
| 21 // implementation for this class should create and maintain the WebContents for |
| 22 // the page, and handle any message passing between the web contents and the |
| 23 // extension system. |
| 24 class CustomLauncherPageContents |
| 25 : public content::WebContentsObserver, |
| 26 public extensions::ExtensionFunctionDispatcher::Delegate { |
| 27 public: |
| 28 CustomLauncherPageContents(); |
| 29 virtual ~CustomLauncherPageContents(); |
| 30 |
| 31 // Called to initialize and load the WebContents. |
| 32 void Initialize(content::BrowserContext* context, const GURL& url); |
| 33 |
| 34 content::WebContents* web_contents() const { return web_contents_.get(); } |
| 35 |
| 36 private: |
| 37 // content::WebContentsObserver overrides: |
| 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 39 |
| 40 // extensions::ExtensionFunctionDispatcher::Delegate overrides: |
| 41 virtual extensions::WindowController* GetExtensionWindowController() |
| 42 const OVERRIDE; |
| 43 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 44 |
| 45 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 46 |
| 47 scoped_ptr<content::WebContents> web_contents_; |
| 48 scoped_ptr<extensions::ExtensionFunctionDispatcher> |
| 49 extension_function_dispatcher_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents); |
| 52 }; |
| 53 |
| 54 } // namespace apps |
| 55 |
| 56 #endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_ |
OLD | NEW |