Added unit test for DevTools' ephemeral port support.
[chromium-blink-merge.git] / apps / shell / browser / shell_app_window.h
blob3df66adbd045ec8312739a8cf027d245d6aadbf4
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.
5 #ifndef APPS_SHELL_BROWSER_SHELL_APP_WINDOW_H_
6 #define APPS_SHELL_BROWSER_SHELL_APP_WINDOW_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/web_contents_observer.h"
11 #include "extensions/browser/extension_function_dispatcher.h"
13 struct ExtensionHostMsg_Request_Params;
14 class GURL;
16 namespace aura {
17 class Window;
20 namespace content {
21 class BrowserContext;
22 class WebContents;
25 namespace extensions {
26 class ExtensionFunctionDispatcher;
29 namespace gfx {
30 class Size;
33 namespace apps {
35 // A simplified app window created by chrome.app.window.create(). Manages the
36 // primary web contents for the app.
37 class ShellAppWindow
38 : public content::WebContentsObserver,
39 public extensions::ExtensionFunctionDispatcher::Delegate {
40 public:
41 ShellAppWindow();
42 virtual ~ShellAppWindow();
44 // Creates the web contents and attaches extension-specific helpers.
45 // Passing a valid |initial_size| to avoid a web contents resize.
46 void Init(content::BrowserContext* context, gfx::Size initial_size);
48 // Starts loading |url| which must be an extension URL.
49 void LoadURL(const GURL& url);
51 // Returns the window hosting the web contents.
52 aura::Window* GetNativeWindow();
54 // Returns the routing ID of the render view host of |web_contents_|.
55 int GetRenderViewRoutingID();
57 // content::WebContentsObserver implementation
58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
60 // extensions::ExtensionFunctionDispatcher::Delegate implementation
61 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
63 private:
64 // IPC handler.
65 void OnRequest(const ExtensionHostMsg_Request_Params& params);
67 scoped_ptr<content::WebContents> web_contents_;
68 scoped_ptr<extensions::ExtensionFunctionDispatcher>
69 extension_function_dispatcher_;
71 DISALLOW_COPY_AND_ASSIGN(ShellAppWindow);
74 } // namespace apps
76 #endif // APPS_SHELL_BROWSER_SHELL_APP_WINDOW_H_