Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: content/browser/debugger/devtools_window.h

Issue 7322004: DevTools: devtools manager should know nothing about DevToolsWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ 5 #ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "content/browser/debugger/devtools_client_host.h" 13 #include "content/browser/debugger/devtools_client_host.h"
13 #include "content/browser/debugger/devtools_toggle_action.h" 14 #include "content/browser/debugger/devtools_toggle_action.h"
14 #include "content/browser/tab_contents/tab_contents_delegate.h" 15 #include "content/browser/tab_contents/tab_contents_delegate.h"
15 #include "content/common/notification_observer.h" 16 #include "content/common/notification_observer.h"
16 #include "content/common/notification_registrar.h" 17 #include "content/common/notification_registrar.h"
17 18
18 namespace IPC { 19 namespace IPC {
19 class Message; 20 class Message;
20 } 21 }
21 22
22 class Browser; 23 class Browser;
23 class BrowserWindow; 24 class BrowserWindow;
24 class Profile; 25 class Profile;
25 class RenderViewHost; 26 class RenderViewHost;
26 class Value; 27 class Value;
27 28
28 class DevToolsWindow 29 class DevToolsWindow
29 : public DevToolsClientHost, 30 : public DevToolsClientHost,
30 public NotificationObserver, 31 public NotificationObserver,
31 public TabContentsDelegate { 32 public TabContentsDelegate {
32 public: 33 public:
33 static const char kDevToolsApp[]; 34 static const char kDevToolsApp[];
34 static TabContentsWrapper* GetDevToolsContents(TabContents* inspected_tab); 35 static TabContentsWrapper* GetDevToolsContents(TabContents* inspected_tab);
36 static DevToolsWindow* FindDevToolsWindow(RenderViewHost* window_rvh);
35 37
36 DevToolsWindow(Profile* profile, RenderViewHost* inspected_rvh, bool docked); 38 static DevToolsWindow* OpenDevToolsWindow(RenderViewHost* inspected_rvh);
39 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh,
40 DevToolsToggleAction action);
41 static void InspectElement(RenderViewHost* inspected_rvh, int x, int y);
42
37 virtual ~DevToolsWindow(); 43 virtual ~DevToolsWindow();
38 44
39 // Overridden from DevToolsClientHost. 45 // Overridden from DevToolsClientHost.
40 virtual DevToolsWindow* AsDevToolsWindow();
41 virtual void SendMessageToClient(const IPC::Message& message); 46 virtual void SendMessageToClient(const IPC::Message& message);
42 virtual void InspectedTabClosing(); 47 virtual void InspectedTabClosing();
43 virtual void TabReplaced(TabContentsWrapper* new_tab); 48 virtual void TabReplaced(TabContentsWrapper* new_tab);
44 49
45 void Show(DevToolsToggleAction action); 50 void Show(DevToolsToggleAction action);
46 void Activate(); 51 void Activate();
47 void SetDocked(bool docked); 52 void SetDocked(bool docked);
48 void Close(); 53 void Close();
49 RenderViewHost* GetRenderViewHost(); 54 RenderViewHost* GetRenderViewHost();
50 55
51 TabContentsWrapper* tab_contents() { return tab_contents_; } 56 TabContentsWrapper* tab_contents() { return tab_contents_; }
52 Browser* browser() { return browser_; } // For tests. 57 Browser* browser() { return browser_; } // For tests.
53 bool is_docked() { return docked_; } 58 bool is_docked() { return docked_; }
54 59
55 private: 60 private:
61 DevToolsWindow(Profile* profile, RenderViewHost* inspected_rvh, bool docked);
62
56 void CreateDevToolsBrowser(); 63 void CreateDevToolsBrowser();
57 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab); 64 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab);
58 BrowserWindow* GetInspectedBrowserWindow(); 65 BrowserWindow* GetInspectedBrowserWindow();
59 bool IsInspectedBrowserPopupOrPanel(); 66 bool IsInspectedBrowserPopupOrPanel();
60 void UpdateFrontendAttachedState(); 67 void UpdateFrontendAttachedState();
61 68
62 // Overridden from NotificationObserver. 69 // Overridden from NotificationObserver.
63 virtual void Observe(NotificationType type, 70 virtual void Observe(NotificationType type,
64 const NotificationSource& source, 71 const NotificationSource& source,
65 const NotificationDetails& details); 72 const NotificationDetails& details);
(...skipping 17 matching lines...) Expand all
83 const gfx::Rect& initial_pos, 90 const gfx::Rect& initial_pos,
84 bool user_gesture); 91 bool user_gesture);
85 virtual void CloseContents(TabContents* source) {} 92 virtual void CloseContents(TabContents* source) {}
86 virtual bool CanReloadContents(TabContents* source) const; 93 virtual bool CanReloadContents(TabContents* source) const;
87 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 94 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
88 bool* is_keyboard_shortcut); 95 bool* is_keyboard_shortcut);
89 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); 96 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
90 97
91 virtual void FrameNavigating(const std::string& url) {} 98 virtual void FrameNavigating(const std::string& url) {}
92 99
100 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh,
101 bool force_open,
102 DevToolsToggleAction action);
103 static DevToolsWindow* AsDevToolsWindow(DevToolsClientHost*);
104
93 Profile* profile_; 105 Profile* profile_;
94 TabContentsWrapper* inspected_tab_; 106 TabContentsWrapper* inspected_tab_;
95 TabContentsWrapper* tab_contents_; 107 TabContentsWrapper* tab_contents_;
96 Browser* browser_; 108 Browser* browser_;
97 bool docked_; 109 bool docked_;
98 bool is_loaded_; 110 bool is_loaded_;
99 DevToolsToggleAction action_on_load_; 111 DevToolsToggleAction action_on_load_;
100 NotificationRegistrar registrar_; 112 NotificationRegistrar registrar_;
113 typedef std::vector<DevToolsWindow*> DevToolsWindowList;
114 static DevToolsWindowList instances_;
101 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); 115 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow);
102 }; 116 };
103 117
104 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ 118 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_sanity_unittest.cc ('k') | content/browser/debugger/devtools_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698