| 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/devtools/devtools_file_helper.h" | 13 #include "chrome/browser/devtools/devtools_file_helper.h" |
| 14 #include "chrome/browser/devtools/devtools_file_system_helper.h" |
| 14 #include "chrome/browser/devtools/devtools_toggle_action.h" | 15 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 15 #include "content/public/browser/devtools_client_host.h" | 16 #include "content/public/browser/devtools_client_host.h" |
| 16 #include "content/public/browser/devtools_frontend_host_delegate.h" | 17 #include "content/public/browser/devtools_frontend_host_delegate.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 20 | 21 |
| 21 class Browser; | 22 class Browser; |
| 22 class BrowserWindow; | 23 class BrowserWindow; |
| 23 class PrefServiceSyncable; | 24 class PrefServiceSyncable; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 enum DevToolsDockSide { | 47 enum DevToolsDockSide { |
| 47 DEVTOOLS_DOCK_SIDE_UNDOCKED = 0, | 48 DEVTOOLS_DOCK_SIDE_UNDOCKED = 0, |
| 48 DEVTOOLS_DOCK_SIDE_BOTTOM, | 49 DEVTOOLS_DOCK_SIDE_BOTTOM, |
| 49 DEVTOOLS_DOCK_SIDE_RIGHT | 50 DEVTOOLS_DOCK_SIDE_RIGHT |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 class DevToolsWindow : private content::NotificationObserver, | 53 class DevToolsWindow : private content::NotificationObserver, |
| 53 private content::WebContentsDelegate, | 54 private content::WebContentsDelegate, |
| 54 private content::DevToolsFrontendHostDelegate, | 55 private content::DevToolsFrontendHostDelegate, |
| 55 private DevToolsFileHelper::Delegate { | 56 private DevToolsFileHelper::Delegate, |
| 57 private DevToolsFileSystemHelper::Delegate { |
| 56 public: | 58 public: |
| 57 static const char kDevToolsApp[]; | 59 static const char kDevToolsApp[]; |
| 58 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 60 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
| 59 static DevToolsWindow* GetDockedInstanceForInspectedTab( | 61 static DevToolsWindow* GetDockedInstanceForInspectedTab( |
| 60 content::WebContents* inspected_tab); | 62 content::WebContents* inspected_tab); |
| 61 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); | 63 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); |
| 62 | 64 |
| 63 static DevToolsWindow* OpenDevToolsWindowForWorker( | 65 static DevToolsWindow* OpenDevToolsWindowForWorker( |
| 64 Profile* profile, | 66 Profile* profile, |
| 65 content::DevToolsAgentHost* worker_agent); | 67 content::DevToolsAgentHost* worker_agent); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 const content::NotificationDetails& details) OVERRIDE; | 137 const content::NotificationDetails& details) OVERRIDE; |
| 136 | 138 |
| 137 void ScheduleAction(DevToolsToggleAction action); | 139 void ScheduleAction(DevToolsToggleAction action); |
| 138 void DoAction(); | 140 void DoAction(); |
| 139 static GURL GetDevToolsUrl(Profile* profile, | 141 static GURL GetDevToolsUrl(Profile* profile, |
| 140 DevToolsDockSide dock_side, | 142 DevToolsDockSide dock_side, |
| 141 bool shared_worker_frontend); | 143 bool shared_worker_frontend); |
| 142 void UpdateTheme(); | 144 void UpdateTheme(); |
| 143 void AddDevToolsExtensionsToClient(); | 145 void AddDevToolsExtensionsToClient(); |
| 144 void CallClientFunction(const std::string& function_name, | 146 void CallClientFunction(const std::string& function_name, |
| 145 const base::Value* arg); | 147 const base::Value* arg1 = NULL, |
| 148 const base::Value* arg2 = NULL); |
| 146 // Overridden from content::WebContentsDelegate. | 149 // Overridden from content::WebContentsDelegate. |
| 147 virtual content::WebContents* OpenURLFromTab( | 150 virtual content::WebContents* OpenURLFromTab( |
| 148 content::WebContents* source, | 151 content::WebContents* source, |
| 149 const content::OpenURLParams& params) OVERRIDE; | 152 const content::OpenURLParams& params) OVERRIDE; |
| 150 virtual void AddNewContents(content::WebContents* source, | 153 virtual void AddNewContents(content::WebContents* source, |
| 151 content::WebContents* new_contents, | 154 content::WebContents* new_contents, |
| 152 WindowOpenDisposition disposition, | 155 WindowOpenDisposition disposition, |
| 153 const gfx::Rect& initial_pos, | 156 const gfx::Rect& initial_pos, |
| 154 bool user_gesture, | 157 bool user_gesture, |
| 155 bool* was_blocked) OVERRIDE; | 158 bool* was_blocked) OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 175 virtual void ActivateWindow() OVERRIDE; | 178 virtual void ActivateWindow() OVERRIDE; |
| 176 virtual void CloseWindow() OVERRIDE; | 179 virtual void CloseWindow() OVERRIDE; |
| 177 virtual void MoveWindow(int x, int y) OVERRIDE; | 180 virtual void MoveWindow(int x, int y) OVERRIDE; |
| 178 virtual void SetDockSide(const std::string& side) OVERRIDE; | 181 virtual void SetDockSide(const std::string& side) OVERRIDE; |
| 179 virtual void OpenInNewTab(const std::string& url) OVERRIDE; | 182 virtual void OpenInNewTab(const std::string& url) OVERRIDE; |
| 180 virtual void SaveToFile(const std::string& url, | 183 virtual void SaveToFile(const std::string& url, |
| 181 const std::string& content, | 184 const std::string& content, |
| 182 bool save_as) OVERRIDE; | 185 bool save_as) OVERRIDE; |
| 183 virtual void AppendToFile(const std::string& url, | 186 virtual void AppendToFile(const std::string& url, |
| 184 const std::string& content) OVERRIDE; | 187 const std::string& content) OVERRIDE; |
| 188 virtual void RequestFileSystemPermissions() OVERRIDE; |
| 189 virtual void SelectFolderAndGrantFileSystemPermission() OVERRIDE; |
| 190 virtual void RevokeFileSystemPermission( |
| 191 const std::string& file_system_path) OVERRIDE; |
| 185 | 192 |
| 186 // Overridden from DevToolsFileHelper::Delegate | 193 // Overridden from DevToolsFileHelper::Delegate |
| 187 virtual void FileSavedAs(const std::string& url) OVERRIDE; | 194 virtual void FileSavedAs(const std::string& url) OVERRIDE; |
| 188 virtual void AppendedTo(const std::string& url) OVERRIDE; | 195 virtual void AppendedTo(const std::string& url) OVERRIDE; |
| 189 | 196 |
| 197 // Overridden from DevToolsFileSystemHelper::Delegate |
| 198 virtual void FileSystemPermissionsLoaded( |
| 199 std::vector<DevToolsFileSystemHelper::FileSystem> file_systems) OVERRIDE; |
| 200 virtual void FileSystemFolderSelected( |
| 201 DevToolsFileSystemHelper::FileSystem file_system) OVERRIDE; |
| 202 virtual void FileSystemFolderSelectionCanceled() OVERRIDE; |
| 203 virtual void FileSystemFolderSelectionError( |
| 204 std::string error_string) OVERRIDE; |
| 205 |
| 206 |
| 190 void UpdateBrowserToolbar(); | 207 void UpdateBrowserToolbar(); |
| 191 bool IsDocked(); | 208 bool IsDocked(); |
| 192 static DevToolsDockSide GetDockSideFromPrefs(Profile* profile); | 209 static DevToolsDockSide GetDockSideFromPrefs(Profile* profile); |
| 193 static std::string SideToString(DevToolsDockSide dock_side); | 210 static std::string SideToString(DevToolsDockSide dock_side); |
| 194 static DevToolsDockSide SideFromString(const std::string& dock_side); | 211 static DevToolsDockSide SideFromString(const std::string& dock_side); |
| 195 | 212 |
| 196 Profile* profile_; | 213 Profile* profile_; |
| 197 content::WebContents* inspected_web_contents_; | 214 content::WebContents* inspected_web_contents_; |
| 198 content::WebContents* web_contents_; | 215 content::WebContents* web_contents_; |
| 199 Browser* browser_; | 216 Browser* browser_; |
| 200 DevToolsDockSide dock_side_; | 217 DevToolsDockSide dock_side_; |
| 201 bool is_loaded_; | 218 bool is_loaded_; |
| 202 DevToolsToggleAction action_on_load_; | 219 DevToolsToggleAction action_on_load_; |
| 203 content::NotificationRegistrar registrar_; | 220 content::NotificationRegistrar registrar_; |
| 204 content::DevToolsClientHost* frontend_host_; | 221 content::DevToolsClientHost* frontend_host_; |
| 205 scoped_ptr<DevToolsFileHelper> file_helper_; | 222 scoped_ptr<DevToolsFileHelper> file_helper_; |
| 223 scoped_refptr<DevToolsFileSystemHelper> file_system_helper_; |
| 206 int width_; | 224 int width_; |
| 207 int height_; | 225 int height_; |
| 208 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 226 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 209 }; | 227 }; |
| 210 | 228 |
| 211 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 229 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |