1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "extensions/browser/app_window/app_window.h"
15 #include "extensions/browser/extension_function_dispatcher.h"
17 class AshPanelWindowController;
24 namespace extensions {
25 struct DraggableRegion;
28 // extensions::AppWindowContents class specific to panel windows created by v1
29 // extenstions. This class maintains a WebContents instance and observes it for
30 // the purpose of passing messages to the extensions system. It also creates
31 // an extensions::WindowController instance for interfacing with the v1
33 class AshPanelContents
34 : public extensions::AppWindowContents,
35 public content::WebContentsObserver,
36 public LauncherFaviconLoader::Delegate,
37 public extensions::ExtensionFunctionDispatcher::Delegate {
39 explicit AshPanelContents(extensions::AppWindow* host);
40 ~AshPanelContents() override;
42 // extensions::AppWindowContents
43 void Initialize(content::BrowserContext* context, const GURL& url) override;
44 void LoadContents(int32 creator_process_id) override;
45 void NativeWindowChanged(
46 extensions::NativeAppWindow* native_app_window) override;
47 void NativeWindowClosed() override;
48 void DispatchWindowShownForTests() const override;
49 content::WebContents* GetWebContents() const override;
51 // LauncherFaviconLoader::Delegate overrides:
52 void FaviconUpdated() override;
54 // extensions::ExtensionFunctionDispatcher::Delegate
55 extensions::WindowController* GetExtensionWindowController() const override;
56 content::WebContents* GetAssociatedWebContents() const override;
58 LauncherFaviconLoader* launcher_favicon_loader_for_test() {
59 return launcher_favicon_loader_.get();
63 // content::WebContentsObserver
64 bool OnMessageReceived(const IPC::Message& message) override;
66 void OnRequest(const ExtensionHostMsg_Request_Params& params);
68 extensions::AppWindow* host_;
70 scoped_ptr<content::WebContents> web_contents_;
71 scoped_ptr<extensions::ExtensionFunctionDispatcher>
72 extension_function_dispatcher_;
73 scoped_ptr<AshPanelWindowController> window_controller_;
74 scoped_ptr<LauncherFaviconLoader> launcher_favicon_loader_;
76 DISALLOW_COPY_AND_ASSIGN(AshPanelContents);
79 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_