| 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_embedder_message_dispatcher.h" | 15 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" |
| 16 #include "chrome/browser/devtools/devtools_file_helper.h" | 16 #include "chrome/browser/devtools/devtools_file_helper.h" |
| 17 #include "chrome/browser/devtools/devtools_file_system_indexer.h" | 17 #include "chrome/browser/devtools/devtools_file_system_indexer.h" |
| 18 #include "chrome/browser/devtools/devtools_toggle_action.h" | 18 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 19 #include "content/public/browser/devtools_client_host.h" | 19 #include "content/public/browser/devtools_client_host.h" |
| 20 #include "content/public/browser/devtools_frontend_host_delegate.h" | 20 #include "content/public/browser/devtools_frontend_host_delegate.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/web_contents_delegate.h" | 23 #include "content/public/browser/web_contents_delegate.h" |
| 24 #include "ui/gfx/insets.h" | |
| 25 #include "ui/gfx/size.h" | 24 #include "ui/gfx/size.h" |
| 26 | 25 |
| 27 class Browser; | 26 class Browser; |
| 28 class BrowserWindow; | 27 class BrowserWindow; |
| 29 class DevToolsControllerTest; | 28 class DevToolsControllerTest; |
| 30 class Profile; | 29 class Profile; |
| 31 | 30 |
| 32 namespace base { | 31 namespace base { |
| 33 class Value; | 32 class Value; |
| 34 } | 33 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 115 |
| 117 // content::DevToolsFrontendHostDelegate: | 116 // content::DevToolsFrontendHostDelegate: |
| 118 virtual void InspectedContentsClosing() OVERRIDE; | 117 virtual void InspectedContentsClosing() OVERRIDE; |
| 119 | 118 |
| 120 content::WebContents* web_contents() { return web_contents_; } | 119 content::WebContents* web_contents() { return web_contents_; } |
| 121 Browser* browser() { return browser_; } // For tests. | 120 Browser* browser() { return browser_; } // For tests. |
| 122 | 121 |
| 123 content::RenderViewHost* GetRenderViewHost(); | 122 content::RenderViewHost* GetRenderViewHost(); |
| 124 | 123 |
| 125 // Inspected WebContents is placed over DevTools WebContents in docked mode. | 124 // Inspected WebContents is placed over DevTools WebContents in docked mode. |
| 126 // The following methods return the insets of inspected WebContents | 125 // The The following method returns the resizing strategy of inspected |
| 127 // relative to DevTools WebContents. | 126 // WebContents relative to DevTools WebContents. |
| 128 gfx::Insets GetContentsInsets() const; | 127 const DevToolsContentsResizingStrategy& GetContentsResizingStrategy() const; |
| 129 | 128 |
| 130 // Minimum size of the docked DevTools WebContents. This includes | 129 // Minimum size of the docked DevTools WebContents. This includes |
| 131 // the overlaying inspected WebContents size. | 130 // the overlaying inspected WebContents size. |
| 132 gfx::Size GetMinimumSize() const; | 131 gfx::Size GetMinimumSize() const; |
| 133 | 132 |
| 134 // BeforeUnload interception //////////////////////////////////////////////// | 133 // BeforeUnload interception //////////////////////////////////////////////// |
| 135 | 134 |
| 136 // In order to preserve any edits the user may have made in devtools, the | 135 // In order to preserve any edits the user may have made in devtools, the |
| 137 // beforeunload event of the inspected page is hooked - devtools gets the | 136 // beforeunload event of the inspected page is hooked - devtools gets the |
| 138 // first shot at handling beforeunload and presents a dialog to the user. If | 137 // first shot at handling beforeunload and presents a dialog to the user. If |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 293 |
| 295 // content::DevToolsFrontendHostDelegate override: | 294 // content::DevToolsFrontendHostDelegate override: |
| 296 virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE; | 295 virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE; |
| 297 | 296 |
| 298 // DevToolsEmbedderMessageDispatcher::Delegate overrides: | 297 // DevToolsEmbedderMessageDispatcher::Delegate overrides: |
| 299 virtual void ActivateWindow() OVERRIDE; | 298 virtual void ActivateWindow() OVERRIDE; |
| 300 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; | 299 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; |
| 301 virtual void CloseWindow() OVERRIDE; | 300 virtual void CloseWindow() OVERRIDE; |
| 302 virtual void SetContentsInsets( | 301 virtual void SetContentsInsets( |
| 303 int left, int top, int right, int bottom) OVERRIDE; | 302 int left, int top, int right, int bottom) OVERRIDE; |
| 303 virtual void SetContentsResizingStrategy( |
| 304 const DevToolsContentsResizingStrategy& strategy) OVERRIDE; |
| 304 virtual void MoveWindow(int x, int y) OVERRIDE; | 305 virtual void MoveWindow(int x, int y) OVERRIDE; |
| 305 virtual void SetIsDocked(bool is_docked) OVERRIDE; | 306 virtual void SetIsDocked(bool is_docked) OVERRIDE; |
| 306 virtual void OpenInNewTab(const std::string& url) OVERRIDE; | 307 virtual void OpenInNewTab(const std::string& url) OVERRIDE; |
| 307 virtual void SaveToFile(const std::string& url, | 308 virtual void SaveToFile(const std::string& url, |
| 308 const std::string& content, | 309 const std::string& content, |
| 309 bool save_as) OVERRIDE; | 310 bool save_as) OVERRIDE; |
| 310 virtual void AppendToFile(const std::string& url, | 311 virtual void AppendToFile(const std::string& url, |
| 311 const std::string& content) OVERRIDE; | 312 const std::string& content) OVERRIDE; |
| 312 virtual void RequestFileSystems() OVERRIDE; | 313 virtual void RequestFileSystems() OVERRIDE; |
| 313 virtual void AddFileSystem() OVERRIDE; | 314 virtual void AddFileSystem() OVERRIDE; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 bool ignore_set_is_docked_; | 375 bool ignore_set_is_docked_; |
| 375 content::NotificationRegistrar registrar_; | 376 content::NotificationRegistrar registrar_; |
| 376 scoped_ptr<content::DevToolsClientHost> frontend_host_; | 377 scoped_ptr<content::DevToolsClientHost> frontend_host_; |
| 377 scoped_ptr<DevToolsFileHelper> file_helper_; | 378 scoped_ptr<DevToolsFileHelper> file_helper_; |
| 378 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_; | 379 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_; |
| 379 typedef std::map< | 380 typedef std::map< |
| 380 int, | 381 int, |
| 381 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > | 382 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > |
| 382 IndexingJobsMap; | 383 IndexingJobsMap; |
| 383 IndexingJobsMap indexing_jobs_; | 384 IndexingJobsMap indexing_jobs_; |
| 384 gfx::Insets contents_insets_; | 385 DevToolsContentsResizingStrategy contents_resizing_strategy_; |
| 385 // True if we're in the process of handling a beforeunload event originating | 386 // True if we're in the process of handling a beforeunload event originating |
| 386 // from the inspected webcontents, see InterceptPageBeforeUnload for details. | 387 // from the inspected webcontents, see InterceptPageBeforeUnload for details. |
| 387 bool intercepted_page_beforeunload_; | 388 bool intercepted_page_beforeunload_; |
| 388 | 389 |
| 389 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; | 390 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; |
| 390 base::WeakPtrFactory<DevToolsWindow> weak_factory_; | 391 base::WeakPtrFactory<DevToolsWindow> weak_factory_; |
| 391 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 392 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 392 }; | 393 }; |
| 393 | 394 |
| 394 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 395 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |