| 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 "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" | 15 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" |
| 16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" | 16 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" |
| 17 #include "chrome/browser/devtools/devtools_file_helper.h" | 17 #include "chrome/browser/devtools/devtools_file_helper.h" |
| 18 #include "chrome/browser/devtools/devtools_file_system_indexer.h" | 18 #include "chrome/browser/devtools/devtools_file_system_indexer.h" |
| 19 #include "chrome/browser/devtools/devtools_toggle_action.h" | 19 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 20 #include "content/public/browser/devtools_client_host.h" | 20 #include "content/public/browser/devtools_client_host.h" |
| 21 #include "content/public/browser/devtools_frontend_host_delegate.h" | 21 #include "content/public/browser/devtools_frontend_host_delegate.h" |
| 22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 24 #include "content/public/browser/web_contents_delegate.h" | 24 #include "content/public/browser/web_contents_delegate.h" |
| 25 #include "ui/gfx/size.h" | 25 #include "ui/gfx/size.h" |
| 26 | 26 |
| 27 class Browser; | 27 class Browser; |
| 28 class BrowserWindow; | 28 class BrowserWindow; |
| 29 class DevToolsControllerTest; | 29 class DevToolsControllerTest; |
| 30 class DevToolsEventForwarder; |
| 30 class Profile; | 31 class Profile; |
| 31 | 32 |
| 32 namespace base { | 33 namespace base { |
| 33 class Value; | 34 class Value; |
| 34 } | 35 } |
| 35 | 36 |
| 36 namespace content { | 37 namespace content { |
| 37 class DevToolsAgentHost; | 38 class DevToolsAgentHost; |
| 38 class DevToolsClientHost; | 39 class DevToolsClientHost; |
| 39 struct FileChooserParams; | 40 struct FileChooserParams; |
| 41 struct NativeWebKeyboardEvent; |
| 40 class RenderViewHost; | 42 class RenderViewHost; |
| 41 class WebContents; | 43 class WebContents; |
| 42 } | 44 } |
| 43 | 45 |
| 44 namespace IPC { | 46 namespace IPC { |
| 45 class Message; | 47 class Message; |
| 46 } | 48 } |
| 47 | 49 |
| 48 namespace user_prefs { | 50 namespace user_prefs { |
| 49 class PrefRegistrySyncable; | 51 class PrefRegistrySyncable; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 virtual ~DevToolsWindow(); | 63 virtual ~DevToolsWindow(); |
| 62 | 64 |
| 63 static std::string GetDevToolsWindowPlacementPrefKey(); | 65 static std::string GetDevToolsWindowPlacementPrefKey(); |
| 64 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 66 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 65 | 67 |
| 66 // Return the DevToolsWindow for the given RenderViewHost if one exists, | 68 // Return the DevToolsWindow for the given RenderViewHost if one exists, |
| 67 // otherwise NULL. | 69 // otherwise NULL. |
| 68 static DevToolsWindow* GetInstanceForInspectedRenderViewHost( | 70 static DevToolsWindow* GetInstanceForInspectedRenderViewHost( |
| 69 content::RenderViewHost* inspected_rvh); | 71 content::RenderViewHost* inspected_rvh); |
| 70 | 72 |
| 73 // Return the DevToolsWindow for the given WebContents if one exists, |
| 74 // otherwise NULL. |
| 75 static DevToolsWindow* GetInstanceForInspectedWebContents( |
| 76 content::WebContents* inspected_web_contents); |
| 77 |
| 71 // Return the DevToolsWindow for the given WebContents if one exists and is | 78 // Return the DevToolsWindow for the given WebContents if one exists and is |
| 72 // docked, otherwise NULL. This method will return only fully initialized | 79 // docked, otherwise NULL. This method will return only fully initialized |
| 73 // window ready to be presented in UI. | 80 // window ready to be presented in UI. |
| 74 // For immediately-ready-to-use but maybe not yet fully initialized DevTools | 81 // For immediately-ready-to-use but maybe not yet fully initialized DevTools |
| 75 // use |GetInstanceForInspectedRenderViewHost| instead. | 82 // use |GetInstanceForInspectedRenderViewHost| instead. |
| 76 static DevToolsWindow* GetDockedInstanceForInspectedTab( | 83 static DevToolsWindow* GetDockedInstanceForInspectedTab( |
| 77 content::WebContents* inspected_tab); | 84 content::WebContents* inspected_tab); |
| 78 | 85 |
| 79 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); | 86 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); |
| 80 | 87 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const DevToolsContentsResizingStrategy& GetContentsResizingStrategy() const; | 133 const DevToolsContentsResizingStrategy& GetContentsResizingStrategy() const; |
| 127 | 134 |
| 128 // Minimum size of the docked DevTools WebContents. This includes | 135 // Minimum size of the docked DevTools WebContents. This includes |
| 129 // the overlaying inspected WebContents size. | 136 // the overlaying inspected WebContents size. |
| 130 gfx::Size GetMinimumSize() const; | 137 gfx::Size GetMinimumSize() const; |
| 131 | 138 |
| 132 // Sets closure to be called after load is done. If already loaded, calls | 139 // Sets closure to be called after load is done. If already loaded, calls |
| 133 // closure immediately. | 140 // closure immediately. |
| 134 void SetLoadCompletedCallback(const base::Closure& closure); | 141 void SetLoadCompletedCallback(const base::Closure& closure); |
| 135 | 142 |
| 143 // Forwards an unhandled keyboard event to the DevTools frontend. |
| 144 bool ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& event); |
| 145 |
| 136 // BeforeUnload interception //////////////////////////////////////////////// | 146 // BeforeUnload interception //////////////////////////////////////////////// |
| 137 | 147 |
| 138 // In order to preserve any edits the user may have made in devtools, the | 148 // In order to preserve any edits the user may have made in devtools, the |
| 139 // beforeunload event of the inspected page is hooked - devtools gets the | 149 // beforeunload event of the inspected page is hooked - devtools gets the |
| 140 // first shot at handling beforeunload and presents a dialog to the user. If | 150 // first shot at handling beforeunload and presents a dialog to the user. If |
| 141 // the user accepts the dialog then the script is given a chance to handle | 151 // the user accepts the dialog then the script is given a chance to handle |
| 142 // it. This way 2 dialogs may be displayed: one from the devtools asking the | 152 // it. This way 2 dialogs may be displayed: one from the devtools asking the |
| 143 // user to confirm that they're ok with their devtools edits going away and | 153 // user to confirm that they're ok with their devtools edits going away and |
| 144 // another from the webpage as the result of its beforeunload handler. | 154 // another from the webpage as the result of its beforeunload handler. |
| 145 // The following set of methods handle beforeunload event flow through | 155 // The following set of methods handle beforeunload event flow through |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 virtual void AddFileSystem() OVERRIDE; | 329 virtual void AddFileSystem() OVERRIDE; |
| 320 virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE; | 330 virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE; |
| 321 virtual void UpgradeDraggedFileSystemPermissions( | 331 virtual void UpgradeDraggedFileSystemPermissions( |
| 322 const std::string& file_system_url) OVERRIDE; | 332 const std::string& file_system_url) OVERRIDE; |
| 323 virtual void IndexPath(int request_id, | 333 virtual void IndexPath(int request_id, |
| 324 const std::string& file_system_path) OVERRIDE; | 334 const std::string& file_system_path) OVERRIDE; |
| 325 virtual void StopIndexing(int request_id) OVERRIDE; | 335 virtual void StopIndexing(int request_id) OVERRIDE; |
| 326 virtual void SearchInPath(int request_id, | 336 virtual void SearchInPath(int request_id, |
| 327 const std::string& file_system_path, | 337 const std::string& file_system_path, |
| 328 const std::string& query) OVERRIDE; | 338 const std::string& query) OVERRIDE; |
| 339 virtual void SetWhitelistedShortcuts(const std::string& message) OVERRIDE; |
| 329 virtual void ZoomIn() OVERRIDE; | 340 virtual void ZoomIn() OVERRIDE; |
| 330 virtual void ZoomOut() OVERRIDE; | 341 virtual void ZoomOut() OVERRIDE; |
| 331 virtual void ResetZoom() OVERRIDE; | 342 virtual void ResetZoom() OVERRIDE; |
| 332 | 343 |
| 333 // DevToolsFileHelper callbacks. | 344 // DevToolsFileHelper callbacks. |
| 334 void FileSavedAs(const std::string& url); | 345 void FileSavedAs(const std::string& url); |
| 335 void CanceledFileSaveAs(const std::string& url); | 346 void CanceledFileSaveAs(const std::string& url); |
| 336 void AppendedTo(const std::string& url); | 347 void AppendedTo(const std::string& url); |
| 337 void FileSystemsLoaded( | 348 void FileSystemsLoaded( |
| 338 const std::vector<DevToolsFileHelper::FileSystem>& file_systems); | 349 const std::vector<DevToolsFileHelper::FileSystem>& file_systems); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 IndexingJobsMap indexing_jobs_; | 403 IndexingJobsMap indexing_jobs_; |
| 393 DevToolsContentsResizingStrategy contents_resizing_strategy_; | 404 DevToolsContentsResizingStrategy contents_resizing_strategy_; |
| 394 // True if we're in the process of handling a beforeunload event originating | 405 // True if we're in the process of handling a beforeunload event originating |
| 395 // from the inspected webcontents, see InterceptPageBeforeUnload for details. | 406 // from the inspected webcontents, see InterceptPageBeforeUnload for details. |
| 396 bool intercepted_page_beforeunload_; | 407 bool intercepted_page_beforeunload_; |
| 397 base::Closure load_completed_callback_; | 408 base::Closure load_completed_callback_; |
| 398 | 409 |
| 399 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; | 410 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; |
| 400 base::WeakPtrFactory<DevToolsWindow> weak_factory_; | 411 base::WeakPtrFactory<DevToolsWindow> weak_factory_; |
| 401 base::TimeTicks inspect_element_start_time_; | 412 base::TimeTicks inspect_element_start_time_; |
| 413 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
| 414 |
| 415 friend class DevToolsEventForwarder; |
| 402 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 416 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 403 }; | 417 }; |
| 404 | 418 |
| 405 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 419 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |