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

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

Issue 9836127: Content shell: Javascript dialogs, first pass, just Mac for now. (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 WebContents; 27 class WebContents;
28 28
29 namespace content { 29 namespace content {
30
30 class BrowserContext; 31 class BrowserContext;
32 class ShellJavaScriptDialogCreator;
31 class SiteInstance; 33 class SiteInstance;
32 34
33 // This represents one window of the Content Shell, i.e. all the UI including 35 // 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. 36 // buttons and url bar, as well as the web content area.
35 class Shell : public WebContentsDelegate, 37 class Shell : public WebContentsDelegate,
36 public WebContentsObserver { 38 public WebContentsObserver {
37 public: 39 public:
38 virtual ~Shell(); 40 virtual ~Shell();
39 41
40 void LoadURL(const GURL& url); 42 void LoadURL(const GURL& url);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 110
109 gfx::NativeView GetContentView(); 111 gfx::NativeView GetContentView();
110 112
111 // content::WebContentsDelegate 113 // content::WebContentsDelegate
112 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; 114 virtual void LoadingStateChanged(WebContents* source) OVERRIDE;
113 virtual void WebContentsCreated(WebContents* source_contents, 115 virtual void WebContentsCreated(WebContents* source_contents,
114 int64 source_frame_id, 116 int64 source_frame_id,
115 const GURL& target_url, 117 const GURL& target_url,
116 WebContents* new_contents) OVERRIDE; 118 WebContents* new_contents) OVERRIDE;
117 virtual void DidNavigateMainFramePostCommit(WebContents* tab) OVERRIDE; 119 virtual void DidNavigateMainFramePostCommit(WebContents* tab) OVERRIDE;
120 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE;
118 #if defined(OS_MACOSX) 121 #if defined(OS_MACOSX)
119 virtual void HandleKeyboardEvent( 122 virtual void HandleKeyboardEvent(
120 const NativeWebKeyboardEvent& event) OVERRIDE; 123 const NativeWebKeyboardEvent& event) OVERRIDE;
121 #endif 124 #endif
122 125
123 // content::WebContentsObserver 126 // content::WebContentsObserver
124 virtual void DidFinishLoad(int64 frame_id, 127 virtual void DidFinishLoad(int64 frame_id,
125 const GURL& validated_url, 128 const GURL& validated_url,
126 bool is_main_frame) OVERRIDE; 129 bool is_main_frame) OVERRIDE;
127 130
128 #if defined(OS_WIN) 131 #if defined(OS_WIN)
129 static ATOM RegisterWindowClass(); 132 static ATOM RegisterWindowClass();
130 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 133 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
131 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); 134 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM);
132 #elif defined(OS_LINUX) 135 #elif defined(OS_LINUX)
133 CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked); 136 CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked);
134 CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked); 137 CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked);
135 CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked); 138 CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked);
136 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked); 139 CHROMEGTK_CALLBACK_0(Shell, void, OnStopButtonClicked);
137 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate); 140 CHROMEGTK_CALLBACK_0(Shell, void, OnURLEntryActivate);
138 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed); 141 CHROMEGTK_CALLBACK_0(Shell, gboolean, OnWindowDestroyed);
139 142
140 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*, 143 CHROMEG_CALLBACK_3(Shell, gboolean, OnCloseWindowKeyPressed, GtkAccelGroup*,
141 GObject*, guint, GdkModifierType); 144 GObject*, guint, GdkModifierType);
142 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*, 145 CHROMEG_CALLBACK_3(Shell, gboolean, OnHighlightURLView, GtkAccelGroup*,
143 GObject*, guint, GdkModifierType); 146 GObject*, guint, GdkModifierType);
144 #endif 147 #endif
145 148
149 scoped_ptr<ShellJavaScriptDialogCreator> dialog_creator_;
150
146 scoped_ptr<WebContents> web_contents_; 151 scoped_ptr<WebContents> web_contents_;
147 152
148 // layoutTestController related variables. 153 // layoutTestController related variables.
149 bool wait_until_done_; 154 bool wait_until_done_;
150 155
151 gfx::NativeWindow window_; 156 gfx::NativeWindow window_;
152 gfx::NativeEditView url_edit_view_; 157 gfx::NativeEditView url_edit_view_;
153 158
154 #if defined(OS_WIN) 159 #if defined(OS_WIN)
155 WNDPROC default_edit_wnd_proc_; 160 WNDPROC default_edit_wnd_proc_;
(...skipping 14 matching lines...) Expand all
170 #endif 175 #endif
171 176
172 // A container of all the open windows. We use a vector so we can keep track 177 // A container of all the open windows. We use a vector so we can keep track
173 // of ordering. 178 // of ordering.
174 static std::vector<Shell*> windows_; 179 static std::vector<Shell*> windows_;
175 }; 180 };
176 181
177 } // namespace content 182 } // namespace content
178 183
179 #endif // CONTENT_SHELL_SHELL_H_ 184 #endif // CONTENT_SHELL_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698