OLD | NEW |
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 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Returns the currently open windows. | 67 // Returns the currently open windows. |
68 static std::vector<Shell*>& windows() { return windows_; } | 68 static std::vector<Shell*>& windows() { return windows_; } |
69 | 69 |
70 // Closes all windows and returns. This runs a message loop. | 70 // Closes all windows and returns. This runs a message loop. |
71 static void CloseAllWindows(); | 71 static void CloseAllWindows(); |
72 | 72 |
73 // Closes all windows and exits. | 73 // Closes all windows and exits. |
74 static void PlatformExit(); | 74 static void PlatformExit(); |
75 | 75 |
76 WebContents* web_contents() const { return web_contents_.get(); } | 76 WebContents* web_contents() const { return web_contents_.get(); } |
| 77 gfx::NativeWindow window() { return window_; } |
77 | 78 |
78 #if defined(OS_MACOSX) | 79 #if defined(OS_MACOSX) |
79 // Public to be called by an ObjC bridge object. | 80 // Public to be called by an ObjC bridge object. |
80 void ActionPerformed(int control); | 81 void ActionPerformed(int control); |
81 void URLEntered(std::string url_string); | 82 void URLEntered(std::string url_string); |
82 #elif defined(OS_ANDROID) | 83 #elif defined(OS_ANDROID) |
83 // Registers the Android Java to native methods. | 84 // Registers the Android Java to native methods. |
84 static bool Register(JNIEnv* env); | 85 static bool Register(JNIEnv* env); |
85 #endif | 86 #endif |
86 | 87 |
| 88 // WebContentsDelegate |
| 89 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; |
| 90 #if defined(OS_ANDROID) |
| 91 virtual void LoadProgressChanged(double progress) OVERRIDE; |
| 92 #endif |
| 93 virtual void WebContentsCreated(WebContents* source_contents, |
| 94 int64 source_frame_id, |
| 95 const GURL& target_url, |
| 96 WebContents* new_contents) OVERRIDE; |
| 97 virtual void DidNavigateMainFramePostCommit( |
| 98 WebContents* web_contents) OVERRIDE; |
| 99 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; |
| 100 #if defined(OS_MACOSX) |
| 101 virtual void HandleKeyboardEvent( |
| 102 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 103 #endif |
| 104 virtual bool AddMessageToConsole(WebContents* source, |
| 105 int32 level, |
| 106 const string16& message, |
| 107 int32 line_no, |
| 108 const string16& source_id) OVERRIDE; |
| 109 |
87 private: | 110 private: |
88 enum UIControl { | 111 enum UIControl { |
89 BACK_BUTTON, | 112 BACK_BUTTON, |
90 FORWARD_BUTTON, | 113 FORWARD_BUTTON, |
91 STOP_BUTTON | 114 STOP_BUTTON |
92 }; | 115 }; |
93 | 116 |
94 explicit Shell(WebContents* web_contents); | 117 explicit Shell(WebContents* web_contents); |
95 | 118 |
96 // Helper to create a new Shell given a newly created WebContents. | 119 // Helper to create a new Shell given a newly created WebContents. |
(...skipping 18 matching lines...) Expand all Loading... |
115 // Set the title of shell window | 138 // Set the title of shell window |
116 void PlatformSetTitle(const string16& title); | 139 void PlatformSetTitle(const string16& title); |
117 | 140 |
118 #if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) | 141 #if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) |
119 // Resizes the main window to the given dimensions. | 142 // Resizes the main window to the given dimensions. |
120 void SizeTo(int width, int height); | 143 void SizeTo(int width, int height); |
121 #endif | 144 #endif |
122 | 145 |
123 gfx::NativeView GetContentView(); | 146 gfx::NativeView GetContentView(); |
124 | 147 |
125 // WebContentsDelegate | |
126 virtual void LoadingStateChanged(WebContents* source) OVERRIDE; | |
127 #if defined(OS_ANDROID) | |
128 virtual void LoadProgressChanged(double progress) OVERRIDE; | |
129 #endif | |
130 virtual void WebContentsCreated(WebContents* source_contents, | |
131 int64 source_frame_id, | |
132 const GURL& target_url, | |
133 WebContents* new_contents) OVERRIDE; | |
134 virtual void DidNavigateMainFramePostCommit( | |
135 WebContents* web_contents) OVERRIDE; | |
136 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; | |
137 #if defined(OS_MACOSX) | |
138 virtual void HandleKeyboardEvent( | |
139 const NativeWebKeyboardEvent& event) OVERRIDE; | |
140 #endif | |
141 virtual bool AddMessageToConsole(WebContents* source, | |
142 int32 level, | |
143 const string16& message, | |
144 int32 line_no, | |
145 const string16& source_id) OVERRIDE; | |
146 | |
147 // NotificationObserver | 148 // NotificationObserver |
148 virtual void Observe(int type, | 149 virtual void Observe(int type, |
149 const NotificationSource& source, | 150 const NotificationSource& source, |
150 const NotificationDetails& details) OVERRIDE; | 151 const NotificationDetails& details) OVERRIDE; |
151 | 152 |
152 #if defined(OS_WIN) && !defined(USE_AURA) | 153 #if defined(OS_WIN) && !defined(USE_AURA) |
153 static ATOM RegisterWindowClass(); | 154 static ATOM RegisterWindowClass(); |
154 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); | 155 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); |
155 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); | 156 static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); |
156 #elif defined(TOOLKIT_GTK) | 157 #elif defined(TOOLKIT_GTK) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 static std::vector<Shell*> windows_; | 203 static std::vector<Shell*> windows_; |
203 | 204 |
204 // True if the destructur of Shell should post a quit closure on the current | 205 // True if the destructur of Shell should post a quit closure on the current |
205 // message loop if the destructed Shell object was the last one. | 206 // message loop if the destructed Shell object was the last one. |
206 static bool quit_message_loop_; | 207 static bool quit_message_loop_; |
207 }; | 208 }; |
208 | 209 |
209 } // namespace content | 210 } // namespace content |
210 | 211 |
211 #endif // CONTENT_SHELL_SHELL_H_ | 212 #endif // CONTENT_SHELL_SHELL_H_ |
OLD | NEW |