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

Side by Side Diff: content/shell/shell.h

Issue 9834092: Content shell: Use only public API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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 CONTENT_SHELL_SHELL_H_ 5 #ifndef CONTENT_SHELL_SHELL_H_
6 #define CONTENT_SHELL_SHELL_H_ 6 #define CONTENT_SHELL_SHELL_H_
7 7
8 #pragma once 8 #pragma once
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/string_piece.h" 14 #include "base/string_piece.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 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 18
19 #if defined(OS_LINUX) 19 #if defined(OS_LINUX)
20 #include <gtk/gtk.h> 20 #include <gtk/gtk.h>
21 #include "ui/base/gtk/gtk_signal.h" 21 #include "ui/base/gtk/gtk_signal.h"
22 22
23 typedef struct _GtkToolItem GtkToolItem; 23 typedef struct _GtkToolItem GtkToolItem;
24 #endif 24 #endif
25 25
26 class GURL; 26 class GURL;
27 class TabContents; 27 class WebContents;
28 28
29 namespace content { 29 namespace content {
30 class BrowserContext; 30 class BrowserContext;
31 class SiteInstance; 31 class SiteInstance;
32 32
33 // This represents one window of the Content Shell, i.e. all the UI including 33 // This represents one window of the Content Shell, i.e. all the UI including
34 // buttons and url bar, as well as the web content area. 34 // buttons and url bar, as well as the web content area.
35 class Shell : public WebContentsDelegate, 35 class Shell : public WebContentsDelegate,
36 public WebContentsObserver { 36 public WebContentsObserver {
37 public: 37 public:
38 virtual ~Shell(); 38 virtual ~Shell();
39 39
40 void LoadURL(const GURL& url); 40 void LoadURL(const GURL& url);
41 void GoBackOrForward(int offset); 41 void GoBackOrForward(int offset);
42 void Reload(); 42 void Reload();
43 void Stop(); 43 void Stop();
44 void UpdateNavigationControls(); 44 void UpdateNavigationControls();
45 45
46 // Do one time initialization at application startup. 46 // Do one time initialization at application startup.
47 static void PlatformInitialize(); 47 static void PlatformInitialize();
48 48
49 // This is called indirectly by the modules that need access resources. 49 // This is called indirectly by the modules that need access resources.
50 static base::StringPiece PlatformResourceProvider(int key); 50 static base::StringPiece PlatformResourceProvider(int key);
51 51
52 static Shell* CreateNewWindow(content::BrowserContext* browser_context, 52 static Shell* CreateNewWindow(content::BrowserContext* browser_context,
53 const GURL& url, 53 const GURL& url,
54 SiteInstance* site_instance, 54 SiteInstance* site_instance,
55 int routing_id, 55 int routing_id,
56 TabContents* base_tab_contents); 56 WebContents* base_web_contents);
57 57
58 // Returns the Shell object corresponding to the given RenderViewHost. 58 // Returns the Shell object corresponding to the given RenderViewHost.
59 static Shell* FromRenderViewHost(RenderViewHost* rvh); 59 static Shell* FromRenderViewHost(RenderViewHost* rvh);
60 60
61 // Closes all windows and exits. 61 // Closes all windows and exits.
62 static void PlatformExit(); 62 static void PlatformExit();
63 63
64 TabContents* tab_contents() const { return tab_contents_.get(); } 64 WebContents* web_contents() const { return web_contents_.get(); }
65 65
66 // layoutTestController related methods. 66 // layoutTestController related methods.
67 void set_wait_until_done() { wait_until_done_ = true; } 67 void set_wait_until_done() { wait_until_done_ = true; }
68 68
69 #if defined(OS_MACOSX) 69 #if defined(OS_MACOSX)
70 // Public to be called by an ObjC bridge object. 70 // Public to be called by an ObjC bridge object.
71 void ActionPerformed(int control); 71 void ActionPerformed(int control);
72 void URLEntered(std::string url_string); 72 void URLEntered(std::string url_string);
73 #endif 73 #endif
74 74
75 private: 75 private:
76 enum UIControl { 76 enum UIControl {
77 BACK_BUTTON, 77 BACK_BUTTON,
78 FORWARD_BUTTON, 78 FORWARD_BUTTON,
79 STOP_BUTTON 79 STOP_BUTTON
80 }; 80 };
81 81
82 explicit Shell(TabContents* tab_contents); 82 explicit Shell(WebContents* web_contents);
83 83
84 // Helper to create a new Shell given a newly created TabContents. 84 // Helper to create a new Shell given a newly created WebContents.
85 static Shell* CreateShell(TabContents* tab_contents); 85 static Shell* CreateShell(WebContents* web_contents);
86 86
87 // All the methods that begin with Platform need to be implemented by the 87 // All the methods that begin with Platform need to be implemented by the
88 // platform specific Shell implementation. 88 // platform specific Shell implementation.
89 // Called from the destructor to let each platform do any necessary cleanup. 89 // Called from the destructor to let each platform do any necessary cleanup.
90 void PlatformCleanUp(); 90 void PlatformCleanUp();
91 // Creates the main window GUI. 91 // Creates the main window GUI.
92 void PlatformCreateWindow(int width, int height); 92 void PlatformCreateWindow(int width, int height);
93 // Links the TabContents into the newly created window. 93 // Links the WebContents into the newly created window.
94 void PlatformSetContents(); 94 void PlatformSetContents();
95 // Resizes the main window to the given dimensions. 95 // Resizes the main window to the given dimensions.
96 void PlatformSizeTo(int width, int height); 96 void PlatformSizeTo(int width, int height);
97 // Resize the content area and GUI. 97 // Resize the content area and GUI.
98 void PlatformResizeSubViews(); 98 void PlatformResizeSubViews();
99 // Enable/disable a button. 99 // Enable/disable a button.
100 void PlatformEnableUIControl(UIControl control, bool is_enabled); 100 void PlatformEnableUIControl(UIControl control, bool is_enabled);
101 // Updates the url in the url bar. 101 // Updates the url in the url bar.
102 void PlatformSetAddressBarURL(const GURL& url); 102 void PlatformSetAddressBarURL(const GURL& url);
103 // Sets whether the spinner is spinning. 103 // Sets whether the spinner is spinning.
(...skipping 27 matching lines...) Expand all
131 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); 131 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked);
132 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); 132 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate);
133 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); 133 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed);
134 134
135 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, 135 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*,
136 GObject*, guint, GdkModifierType); 136 GObject*, guint, GdkModifierType);
137 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, 137 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*,
138 GObject*, guint, GdkModifierType); 138 GObject*, guint, GdkModifierType);
139 #endif 139 #endif
140 140
141 scoped_ptr<TabContents> tab_contents_; 141 scoped_ptr<WebContents> web_contents_;
142 142
143 // layoutTestController related variables. 143 // layoutTestController related variables.
144 bool wait_until_done_; 144 bool wait_until_done_;
145 145
146 gfx::NativeWindow window_; 146 gfx::NativeWindow window_;
147 gfx::NativeEditView url_edit_view_; 147 gfx::NativeEditView url_edit_view_;
148 148
149 #if defined(OS_WIN) 149 #if defined(OS_WIN)
150 WNDPROC default_edit_wnd_proc_; 150 WNDPROC default_edit_wnd_proc_;
151 static HINSTANCE instance_handle_; 151 static HINSTANCE instance_handle_;
(...skipping 13 matching lines...) Expand all
165 #endif 165 #endif
166 166
167 // A container of all the open windows. We use a vector so we can keep track 167 // A container of all the open windows. We use a vector so we can keep track
168 // of ordering. 168 // of ordering.
169 static std::vector<Shell*> windows_; 169 static std::vector<Shell*> windows_;
170 }; 170 };
171 171
172 } // namespace content 172 } // namespace content
173 173
174 #endif // CONTENT_SHELL_SHELL_H_ 174 #endif // CONTENT_SHELL_SHELL_H_
OLDNEW
« content/shell/DEPS ('K') | « content/shell/DEPS ('k') | content/shell/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698