Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/ui/extensions/shell_window.h

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_
6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ 6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" 10 #include "chrome/browser/extensions/extension_function_dispatcher.h"
11 #include "chrome/browser/sessions/session_id.h" 11 #include "chrome/browser/sessions/session_id.h"
12 #include "chrome/browser/ui/base_window.h" 12 #include "chrome/browser/ui/base_window.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/browser/web_contents_delegate.h" 15 #include "content/public/browser/web_contents_delegate.h"
16 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
17 17
18 class Extension;
19 class ExtensionWindowController; 18 class ExtensionWindowController;
20 class GURL; 19 class GURL;
21 class Profile; 20 class Profile;
22 class TabContentsWrapper; 21 class TabContentsWrapper;
23 22
24 namespace content { 23 namespace content {
25 class WebContents; 24 class WebContents;
26 } 25 }
27 26
27 namespace extensions {
28 class Extension;
29 }
30
28 // ShellWindow is the type of window used by platform apps. Shell windows 31 // ShellWindow is the type of window used by platform apps. Shell windows
29 // have a WebContents but none of the chrome of normal browser windows. 32 // have a WebContents but none of the chrome of normal browser windows.
30 class ShellWindow : public content::NotificationObserver, 33 class ShellWindow : public content::NotificationObserver,
31 public content::WebContentsDelegate, 34 public content::WebContentsDelegate,
32 public content::WebContentsObserver, 35 public content::WebContentsObserver,
33 public ExtensionFunctionDispatcher::Delegate, 36 public ExtensionFunctionDispatcher::Delegate,
34 public BaseWindow { 37 public BaseWindow {
35 public: 38 public:
36 static ShellWindow* Create(Profile* profile, 39 static ShellWindow* Create(Profile* profile,
37 const Extension* extension, 40 const extensions::Extension* extension,
38 const GURL& url); 41 const GURL& url);
39 42
40 const SessionID& session_id() const { return session_id_; } 43 const SessionID& session_id() const { return session_id_; }
41 const ExtensionWindowController* extension_window_controller() const { 44 const ExtensionWindowController* extension_window_controller() const {
42 return extension_window_controller_.get(); 45 return extension_window_controller_.get();
43 } 46 }
44 47
45 protected: 48 protected:
46 // TODO(mihaip): Switch from hardcoded defaults to passing in the window 49 // TODO(mihaip): Switch from hardcoded defaults to passing in the window
47 // creation parameters to ShellWindow::Create. 50 // creation parameters to ShellWindow::Create.
48 static const int kDefaultWidth = 512; 51 static const int kDefaultWidth = 512;
49 static const int kDefaultHeight = 384; 52 static const int kDefaultHeight = 384;
50 53
51 ShellWindow(Profile* profile, 54 ShellWindow(Profile* profile,
52 const Extension* extension, 55 const extensions::Extension* extension,
53 const GURL& url); 56 const GURL& url);
54 virtual ~ShellWindow(); 57 virtual ~ShellWindow();
55 58
56 const Extension* extension() const { return extension_; } 59 const extensions::Extension* extension() const { return extension_; }
57 content::WebContents* web_contents() const { return web_contents_; } 60 content::WebContents* web_contents() const { return web_contents_; }
58 61
59 private: 62 private:
60 // PlatformAppBrowserTest needs access to web_contents() 63 // PlatformAppBrowserTest needs access to web_contents()
61 friend class PlatformAppBrowserTest; 64 friend class PlatformAppBrowserTest;
62 65
63 // Instantiates a platform-specific ShellWindow subclass (one implementation 66 // Instantiates a platform-specific ShellWindow subclass (one implementation
64 // per platform). Public users of ShellWindow should use ShellWindow::Create. 67 // per platform). Public users of ShellWindow should use ShellWindow::Create.
65 static ShellWindow* CreateImpl(Profile* profile, 68 static ShellWindow* CreateImpl(Profile* profile,
66 const Extension* extension, 69 const extensions::Extension* extension,
67 const GURL& url); 70 const GURL& url);
68 71
69 // content::WebContentsObserver implementation. 72 // content::WebContentsObserver implementation.
70 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 73 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
71 74
72 // content::WebContentsDelegate implementation. 75 // content::WebContentsDelegate implementation.
73 virtual void CloseContents(content::WebContents* contents) OVERRIDE; 76 virtual void CloseContents(content::WebContents* contents) OVERRIDE;
74 virtual bool ShouldSuppressDialogs() OVERRIDE; 77 virtual bool ShouldSuppressDialogs() OVERRIDE;
75 virtual void WebIntentDispatch( 78 virtual void WebIntentDispatch(
76 content::WebContents* web_contents, 79 content::WebContents* web_contents,
77 content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; 80 content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE;
78 virtual void RunFileChooser( 81 virtual void RunFileChooser(
79 content::WebContents* tab, 82 content::WebContents* tab,
80 const content::FileChooserParams& params) OVERRIDE; 83 const content::FileChooserParams& params) OVERRIDE;
81 84
82 // content::NotificationObserver implementation. 85 // content::NotificationObserver implementation.
83 virtual void Observe(int type, 86 virtual void Observe(int type,
84 const content::NotificationSource& source, 87 const content::NotificationSource& source,
85 const content::NotificationDetails& details) OVERRIDE; 88 const content::NotificationDetails& details) OVERRIDE;
86 89
87 // ExtensionFunctionDispatcher::Delegate implementation. 90 // ExtensionFunctionDispatcher::Delegate implementation.
88 virtual ExtensionWindowController* GetExtensionWindowController() const 91 virtual ExtensionWindowController* GetExtensionWindowController() const
89 OVERRIDE; 92 OVERRIDE;
90 93
91 // Message handlers. 94 // Message handlers.
92 void OnRequest(const ExtensionHostMsg_Request_Params& params); 95 void OnRequest(const ExtensionHostMsg_Request_Params& params);
93 96
94 Profile* profile_; // weak pointer - owned by ProfileManager. 97 Profile* profile_; // weak pointer - owned by ProfileManager.
95 const Extension* extension_; // weak pointer - owned by ExtensionService. 98 // weak pointer - owned by ExtensionService.
99 const extensions::Extension* extension_;
96 100
97 const SessionID session_id_; 101 const SessionID session_id_;
98 scoped_ptr<TabContentsWrapper> contents_wrapper_; 102 scoped_ptr<TabContentsWrapper> contents_wrapper_;
99 // web_contents_ is owned by contents_wrapper_. 103 // web_contents_ is owned by contents_wrapper_.
100 content::WebContents* web_contents_; 104 content::WebContents* web_contents_;
101 content::NotificationRegistrar registrar_; 105 content::NotificationRegistrar registrar_;
102 scoped_ptr<ExtensionWindowController> extension_window_controller_; 106 scoped_ptr<ExtensionWindowController> extension_window_controller_;
103 ExtensionFunctionDispatcher extension_function_dispatcher_; 107 ExtensionFunctionDispatcher extension_function_dispatcher_;
104 108
105 DISALLOW_COPY_AND_ASSIGN(ShellWindow); 109 DISALLOW_COPY_AND_ASSIGN(ShellWindow);
106 }; 110 };
107 111
108 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ 112 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm ('k') | chrome/browser/ui/extensions/shell_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698