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

Side by Side Diff: content/browser/debugger/devtools_handler.cc

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 #include "content/browser/debugger/devtools_handler.h" 5 #include "content/browser/debugger/devtools_handler.h"
6 6
7 #include "content/browser/debugger/devtools_file_util.h" 7 #include "content/browser/debugger/devtools_file_util.h"
8 #include "content/browser/debugger/devtools_manager.h" 8 #include "content/browser/debugger/devtools_manager.h"
9 #include "content/browser/debugger/devtools_window.h"
9 #include "content/browser/renderer_host/render_view_host.h" 10 #include "content/browser/renderer_host/render_view_host.h"
10 #include "content/browser/tab_contents/tab_contents.h" 11 #include "content/browser/tab_contents/tab_contents.h"
11 #include "content/common/devtools_messages.h" 12 #include "content/common/devtools_messages.h"
12 13
13 DevToolsHandler::DevToolsHandler(RenderViewHost* render_view_host) 14 DevToolsHandler::DevToolsHandler(RenderViewHost* render_view_host)
14 : RenderViewHostObserver(render_view_host) { 15 : RenderViewHostObserver(render_view_host) {
15 } 16 }
16 17
17 DevToolsHandler::~DevToolsHandler() { 18 DevToolsHandler::~DevToolsHandler() {
18 } 19 }
(...skipping 11 matching lines...) Expand all
30 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAs, 31 IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAs,
31 OnSaveAs) 32 OnSaveAs)
32 IPC_MESSAGE_HANDLER(DevToolsHostMsg_RuntimePropertyChanged, 33 IPC_MESSAGE_HANDLER(DevToolsHostMsg_RuntimePropertyChanged,
33 OnRuntimePropertyChanged) 34 OnRuntimePropertyChanged)
34 IPC_MESSAGE_UNHANDLED(handled = false) 35 IPC_MESSAGE_UNHANDLED(handled = false)
35 IPC_END_MESSAGE_MAP() 36 IPC_END_MESSAGE_MAP()
36 return handled; 37 return handled;
37 } 38 }
38 39
39 void DevToolsHandler::OnForwardToAgent(const IPC::Message& message) { 40 void DevToolsHandler::OnForwardToAgent(const IPC::Message& message) {
40 DevToolsManager::GetInstance()->ForwardToDevToolsAgent( 41 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(
41 render_view_host(), message); 42 render_view_host());
43 if (!window)
44 return;
45 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(window, message);
42 } 46 }
43 47
44 void DevToolsHandler::OnForwardToClient(const IPC::Message& message) { 48 void DevToolsHandler::OnForwardToClient(const IPC::Message& message) {
45 DevToolsManager::GetInstance()->ForwardToDevToolsClient( 49 DevToolsManager::GetInstance()->ForwardToDevToolsClient(
46 render_view_host(), message); 50 render_view_host(), message);
47 } 51 }
48 52
49 void DevToolsHandler::OnActivateWindow() { 53 void DevToolsHandler::OnActivateWindow() {
50 DevToolsManager::GetInstance()->ActivateWindow(render_view_host()); 54 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(
55 render_view_host());
56 if (window)
57 window->Activate();
51 } 58 }
52 59
53 void DevToolsHandler::OnCloseWindow() { 60 void DevToolsHandler::OnCloseWindow() {
54 DevToolsManager::GetInstance()->CloseWindow(render_view_host()); 61 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(
62 render_view_host());
63 if (window)
64 window->Close();
55 } 65 }
56 66
57 void DevToolsHandler::OnRequestDockWindow() { 67 void DevToolsHandler::OnRequestDockWindow() {
58 DevToolsManager::GetInstance()->RequestDockWindow(render_view_host()); 68 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(
69 render_view_host());
70 if (window)
71 window->SetDocked(true);
59 } 72 }
60 73
61 void DevToolsHandler::OnRequestUndockWindow() { 74 void DevToolsHandler::OnRequestUndockWindow() {
62 DevToolsManager::GetInstance()->RequestUndockWindow(render_view_host()); 75 DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(
76 render_view_host());
77 if (window)
78 window->SetDocked(false);
63 } 79 }
64 80
65 void DevToolsHandler::OnSaveAs(const std::string& file_name, 81 void DevToolsHandler::OnSaveAs(const std::string& file_name,
66 const std::string& content) { 82 const std::string& content) {
67 TabContents* tab_contents = render_view_host()->delegate() ? 83 TabContents* tab_contents = render_view_host()->delegate() ?
68 render_view_host()->delegate()->GetAsTabContents() : NULL; 84 render_view_host()->delegate()->GetAsTabContents() : NULL;
69 DCHECK(tab_contents); 85 DCHECK(tab_contents);
70 if (!tab_contents) 86 if (!tab_contents)
71 return; 87 return;
72 88
73 DevToolsFileUtil::SaveAs(tab_contents->profile(), file_name, content); 89 DevToolsFileUtil::SaveAs(tab_contents->profile(), file_name, content);
74 } 90 }
75 91
76 void DevToolsHandler::OnRuntimePropertyChanged(const std::string& name, 92 void DevToolsHandler::OnRuntimePropertyChanged(const std::string& name,
77 const std::string& value) { 93 const std::string& value) {
78 DevToolsManager::GetInstance()->RuntimePropertyChanged( 94 DevToolsManager::GetInstance()->RuntimePropertyChanged(
79 render_view_host(), name, value); 95 render_view_host(), name, value);
80 } 96 }
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_client_host.cc ('k') | content/browser/debugger/devtools_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698