| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_DEBUGGER_DEV_TOOLS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEV_TOOLS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_DEBUGGER_DEV_TOOLS_WINDOW_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEV_TOOLS_WINDOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" |
| 11 #include "chrome/browser/debugger/devtools_client_host.h" | 12 #include "chrome/browser/debugger/devtools_client_host.h" |
| 13 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 12 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 13 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
| 14 | 16 |
| 15 namespace IPC { | 17 namespace IPC { |
| 16 class Message; | 18 class Message; |
| 17 } | 19 } |
| 18 | 20 |
| 19 class Browser; | 21 class Browser; |
| 20 class BrowserWindow; | 22 class BrowserWindow; |
| 21 class Profile; | 23 class Profile; |
| 22 class RenderViewHost; | 24 class RenderViewHost; |
| 23 class TabContents; | 25 class TabContents; |
| 24 | 26 |
| 25 class DevToolsWindow : public DevToolsClientHost, public NotificationObserver { | 27 class DevToolsWindow : |
| 28 public DevToolsClientHost, |
| 29 public NotificationObserver, |
| 30 TabContentsDelegate { |
| 26 public: | 31 public: |
| 27 static DevToolsWindow* CreateDevToolsWindow(Profile* profile, | |
| 28 RenderViewHost* inspected_rvh, | |
| 29 bool docked); | |
| 30 | |
| 31 static TabContents* GetDevToolsContents(TabContents* inspected_tab); | 32 static TabContents* GetDevToolsContents(TabContents* inspected_tab); |
| 32 | 33 |
| 34 DevToolsWindow(Profile* profile, RenderViewHost* inspected_rvh, bool docked); |
| 33 virtual ~DevToolsWindow(); | 35 virtual ~DevToolsWindow(); |
| 34 virtual void Show() = 0; | 36 |
| 35 virtual void Activate() = 0; | 37 // Overridden from DevToolsClientHost. |
| 36 bool is_docked() { return docked_; }; | 38 virtual DevToolsWindow* AsDevToolsWindow(); |
| 39 virtual void SendMessageToClient(const IPC::Message& message); |
| 40 virtual void InspectedTabClosing(); |
| 41 |
| 42 void Show(); |
| 43 void Activate(); |
| 44 void SetDocked(bool docked); |
| 37 RenderViewHost* GetRenderViewHost(); | 45 RenderViewHost* GetRenderViewHost(); |
| 38 | 46 |
| 39 // DevToolsClientHost override. | 47 TabContents* tab_contents() { return tab_contents_; } |
| 40 virtual DevToolsWindow* AsDevToolsWindow(); | 48 Browser* browser() { return browser_; } // For tests. |
| 41 virtual void SendMessageToClient(const IPC::Message& message); | 49 bool is_docked() { return docked_; }; |
| 42 | 50 |
| 43 // NotificationObserver override. | 51 private: |
| 52 void CreateDevToolsBrowser(); |
| 53 BrowserWindow* GetInspectedBrowserWindow(); |
| 54 |
| 55 // Overridden from NotificationObserver. |
| 44 virtual void Observe(NotificationType type, | 56 virtual void Observe(NotificationType type, |
| 45 const NotificationSource& source, | 57 const NotificationSource& source, |
| 46 const NotificationDetails& details); | 58 const NotificationDetails& details); |
| 47 | 59 |
| 48 TabContents* tab_contents() { return tab_contents_; } | 60 // Overridden from TabContentsDelegate. |
| 49 Browser* browser() { return browser_; } | 61 virtual void OpenURLFromTab(TabContents* source, |
| 62 const GURL& url, |
| 63 const GURL& referrer, |
| 64 WindowOpenDisposition disposition, |
| 65 PageTransition::Type transition) {} |
| 66 virtual void NavigationStateChanged(const TabContents* source, |
| 67 unsigned changed_flags) {} |
| 68 virtual void AddNewContents(TabContents* source, |
| 69 TabContents* new_contents, |
| 70 WindowOpenDisposition disposition, |
| 71 const gfx::Rect& initial_pos, |
| 72 bool user_gesture) {} |
| 73 virtual void ActivateContents(TabContents* contents) {} |
| 74 virtual void LoadingStateChanged(TabContents* source) {} |
| 75 virtual void CloseContents(TabContents* source) {} |
| 76 virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} |
| 77 virtual bool IsPopup(TabContents* source) { return false; } |
| 78 virtual void URLStarredChanged(TabContents* source, bool starred) {} |
| 79 virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} |
| 80 virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {} |
| 50 | 81 |
| 51 protected: | 82 Profile* profile_; |
| 52 DevToolsWindow(bool docked); | 83 TabContents* inspected_tab_; |
| 53 GURL GetContentsUrl(); | |
| 54 void InitTabContents(TabContents* tab_contents); | |
| 55 | |
| 56 TabContents* tab_contents_; | 84 TabContents* tab_contents_; |
| 57 Browser* browser_; | 85 Browser* browser_; |
| 58 | 86 BrowserWindow* inspected_window_; |
| 59 private: | 87 bool docked_; |
| 60 static BrowserWindow* GetBrowserWindow(RenderViewHost* rvh); | |
| 61 NotificationRegistrar registrar_; | 88 NotificationRegistrar registrar_; |
| 62 | |
| 63 bool docked_; | |
| 64 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 89 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 65 }; | 90 }; |
| 66 | 91 |
| 67 #endif // CHROME_BROWSER_DEBUGGER_DEV_TOOLS_WINDOW_H_ | 92 #endif // CHROME_BROWSER_DEBUGGER_DEV_TOOLS_WINDOW_H_ |
| OLD | NEW |