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

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: rebase Created 8 years, 8 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
« no previous file with comments | « content/shell/DEPS ('k') | content/shell/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Resize the content area and GUI. 95 // Resize the content area and GUI.
96 void PlatformResizeSubViews(); 96 void PlatformResizeSubViews();
97 // Enable/disable a button. 97 // Enable/disable a button.
98 void PlatformEnableUIControl(UIControl control, bool is_enabled); 98 void PlatformEnableUIControl(UIControl control, bool is_enabled);
99 // Updates the url in the url bar. 99 // Updates the url in the url bar.
100 void PlatformSetAddressBarURL(const GURL& url); 100 void PlatformSetAddressBarURL(const GURL& url);
101 // Sets whether the spinner is spinning. 101 // Sets whether the spinner is spinning.
102 void PlatformSetIsLoading(bool loading); 102 void PlatformSetIsLoading(bool loading);
103 103
(...skipping 28 matching lines...) Expand all
132 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); 132 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked);
133 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); 133 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate);
134 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); 134 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed);
135 135
136 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, 136 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*,
137 GObject*, guint, GdkModifierType); 137 GObject*, guint, GdkModifierType);
138 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, 138 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*,
139 GObject*, guint, GdkModifierType); 139 GObject*, guint, GdkModifierType);
140 #endif 140 #endif
141 141
142 scoped_ptr<TabContents> tab_contents_; 142 scoped_ptr<WebContents> web_contents_;
143 143
144 // layoutTestController related variables. 144 // layoutTestController related variables.
145 bool wait_until_done_; 145 bool wait_until_done_;
146 146
147 gfx::NativeWindow window_; 147 gfx::NativeWindow window_;
148 gfx::NativeEditView url_edit_view_; 148 gfx::NativeEditView url_edit_view_;
149 149
150 #if defined(OS_WIN) 150 #if defined(OS_WIN)
151 WNDPROC default_edit_wnd_proc_; 151 WNDPROC default_edit_wnd_proc_;
152 static HINSTANCE instance_handle_; 152 static HINSTANCE instance_handle_;
(...skipping 13 matching lines...) Expand all
166 #endif 166 #endif
167 167
168 // A container of all the open windows. We use a vector so we can keep track 168 // A container of all the open windows. We use a vector so we can keep track
169 // of ordering. 169 // of ordering.
170 static std::vector<Shell*> windows_; 170 static std::vector<Shell*> windows_;
171 }; 171 };
172 172
173 } // namespace content 173 } // namespace content
174 174
175 #endif // CONTENT_SHELL_SHELL_H_ 175 #endif // CONTENT_SHELL_SHELL_H_
OLDNEW
« no previous file with comments | « content/shell/DEPS ('k') | content/shell/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698