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

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 2 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 21
23 namespace content { 22 namespace content {
24 class WebContents; 23 class WebContents;
25 } 24 }
26 25
26 namespace extensions {
27 class Extension;
28 }
29
27 // ShellWindow is the type of window used by platform apps. Shell windows 30 // ShellWindow is the type of window used by platform apps. Shell windows
28 // have a WebContents but none of the chrome of normal browser windows. 31 // have a WebContents but none of the chrome of normal browser windows.
29 class ShellWindow : public content::NotificationObserver, 32 class ShellWindow : public content::NotificationObserver,
30 public content::WebContentsDelegate, 33 public content::WebContentsDelegate,
31 public content::WebContentsObserver, 34 public content::WebContentsObserver,
32 public ExtensionFunctionDispatcher::Delegate, 35 public ExtensionFunctionDispatcher::Delegate,
33 public BaseWindow { 36 public BaseWindow {
34 public: 37 public:
35 static ShellWindow* Create(Profile* profile, 38 static ShellWindow* Create(Profile* profile,
36 const Extension* extension, 39 const extensions::Extension* extension,
37 const GURL& url); 40 const GURL& url);
38 41
39 const SessionID& session_id() const { return session_id_; } 42 const SessionID& session_id() const { return session_id_; }
40 const ExtensionWindowController* extension_window_controller() const { 43 const ExtensionWindowController* extension_window_controller() const {
41 return extension_window_controller_.get(); 44 return extension_window_controller_.get();
42 } 45 }
43 46
44 protected: 47 protected:
45 // TODO(mihaip): Switch from hardcoded defaults to passing in the window 48 // TODO(mihaip): Switch from hardcoded defaults to passing in the window
46 // creation parameters to ShellWindow::Create. 49 // creation parameters to ShellWindow::Create.
47 static const int kDefaultWidth = 512; 50 static const int kDefaultWidth = 512;
48 static const int kDefaultHeight = 384; 51 static const int kDefaultHeight = 384;
49 52
50 ShellWindow(Profile* profile, 53 ShellWindow(Profile* profile,
51 const Extension* extension, 54 const extensions::Extension* extension,
52 const GURL& url); 55 const GURL& url);
53 virtual ~ShellWindow(); 56 virtual ~ShellWindow();
54 57
55 const Extension* extension() const { return extension_; } 58 const extensions::Extension* extension() const { return extension_; }
56 content::WebContents* web_contents() const { return web_contents_.get(); } 59 content::WebContents* web_contents() const { return web_contents_.get(); }
57 60
58 private: 61 private:
59 // PlatformAppBrowserTest needs access to web_contents() 62 // PlatformAppBrowserTest needs access to web_contents()
60 friend class PlatformAppBrowserTest; 63 friend class PlatformAppBrowserTest;
61 64
62 // Instantiates a platform-specific ShellWindow subclass (one implementation 65 // Instantiates a platform-specific ShellWindow subclass (one implementation
63 // per platform). Public users of ShellWindow should use ShellWindow::Create. 66 // per platform). Public users of ShellWindow should use ShellWindow::Create.
64 static ShellWindow* CreateImpl(Profile* profile, 67 static ShellWindow* CreateImpl(Profile* profile,
65 const Extension* extension, 68 const extensions::Extension* extension,
66 const GURL& url); 69 const GURL& url);
67 70
68 // content::WebContentsObserver 71 // content::WebContentsObserver
69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
70 73
71 // content::WebContentsDelegate 74 // content::WebContentsDelegate
72 virtual void CloseContents(content::WebContents* contents) OVERRIDE; 75 virtual void CloseContents(content::WebContents* contents) OVERRIDE;
73 virtual bool ShouldSuppressDialogs() OVERRIDE; 76 virtual bool ShouldSuppressDialogs() OVERRIDE;
74 77
75 // content::NotificationObserver implementation. 78 // content::NotificationObserver implementation.
76 virtual void Observe(int type, 79 virtual void Observe(int type,
77 const content::NotificationSource& source, 80 const content::NotificationSource& source,
78 const content::NotificationDetails& details) OVERRIDE; 81 const content::NotificationDetails& details) OVERRIDE;
79 82
80 virtual ExtensionWindowController* GetExtensionWindowController() const 83 virtual ExtensionWindowController* GetExtensionWindowController() const
81 OVERRIDE; 84 OVERRIDE;
82 85
83 // Message handlers. 86 // Message handlers.
84 void OnRequest(const ExtensionHostMsg_Request_Params& params); 87 void OnRequest(const ExtensionHostMsg_Request_Params& params);
85 88
86 Profile* profile_; // weak pointer - owned by ProfileManager. 89 Profile* profile_; // weak pointer - owned by ProfileManager.
87 const Extension* extension_; // weak pointer - owned by ExtensionService. 90 // weak pointer - owned by ExtensionService.
91 const extensions::Extension* extension_;
88 92
89 const SessionID session_id_; 93 const SessionID session_id_;
90 scoped_ptr<content::WebContents> web_contents_; 94 scoped_ptr<content::WebContents> web_contents_;
91 content::NotificationRegistrar registrar_; 95 content::NotificationRegistrar registrar_;
92 scoped_ptr<ExtensionWindowController> extension_window_controller_; 96 scoped_ptr<ExtensionWindowController> extension_window_controller_;
93 ExtensionFunctionDispatcher extension_function_dispatcher_; 97 ExtensionFunctionDispatcher extension_function_dispatcher_;
94 98
95 DISALLOW_COPY_AND_ASSIGN(ShellWindow); 99 DISALLOW_COPY_AND_ASSIGN(ShellWindow);
96 }; 100 };
97 101
98 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ 102 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698