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 "apps/app_window.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/extension_function_dispatcher.h"
14 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h"
15 #include "content/public/browser/web_contents_observer.h"
17 class AshPanelWindowController;
24 namespace extensions {
25 struct DraggableRegion;
28 // apps::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 : public apps::AppWindowContents,
34 public content::WebContentsObserver,
35 public LauncherFaviconLoader::Delegate,
36 public ExtensionFunctionDispatcher::Delegate {
38 explicit AshPanelContents(apps::AppWindow* host);
39 virtual ~AshPanelContents();
41 // apps::AppWindowContents
42 virtual void Initialize(content::BrowserContext* context,
43 const GURL& url) OVERRIDE;
44 virtual void LoadContents(int32 creator_process_id) OVERRIDE;
45 virtual void NativeWindowChanged(apps::NativeAppWindow* native_app_window)
47 virtual void NativeWindowClosed() OVERRIDE;
48 virtual content::WebContents* GetWebContents() const OVERRIDE;
50 // LauncherFaviconLoader::Delegate overrides:
51 virtual void FaviconUpdated() OVERRIDE;
53 // ExtensionFunctionDispatcher::Delegate
54 virtual extensions::WindowController* GetExtensionWindowController() const
56 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
58 LauncherFaviconLoader* launcher_favicon_loader_for_test() {
59 return launcher_favicon_loader_.get();
63 // content::WebContentsObserver
64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
66 void OnRequest(const ExtensionHostMsg_Request_Params& params);
68 apps::AppWindow* host_;
70 scoped_ptr<content::WebContents> web_contents_;
71 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
72 scoped_ptr<AshPanelWindowController> window_controller_;
73 scoped_ptr<LauncherFaviconLoader> launcher_favicon_loader_;
75 DISALLOW_COPY_AND_ASSIGN(AshPanelContents);
78 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_ASH_PANEL_CONTENTS_H_