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

Side by Side Diff: webkit/glue/inspector_client_impl.cc

Issue 182009: DevTools: call InspectorController.close on detach (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « webkit/glue/inspector_client_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "config.h" 5 #include "config.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 MSVC_PUSH_WARNING_LEVEL(0); 9 MSVC_PUSH_WARNING_LEVEL(0);
10 #include "DOMWindow.h" 10 #include "DOMWindow.h"
(...skipping 24 matching lines...) Expand all
35 using WebKit::WebRect; 35 using WebKit::WebRect;
36 using WebKit::WebSize; 36 using WebKit::WebSize;
37 using WebKit::WebURLRequest; 37 using WebKit::WebURLRequest;
38 38
39 static const float kDefaultInspectorXPos = 10; 39 static const float kDefaultInspectorXPos = 10;
40 static const float kDefaultInspectorYPos = 50; 40 static const float kDefaultInspectorYPos = 50;
41 static const float kDefaultInspectorHeight = 640; 41 static const float kDefaultInspectorHeight = 640;
42 static const float kDefaultInspectorWidth = 480; 42 static const float kDefaultInspectorWidth = 480;
43 43
44 WebInspectorClient::WebInspectorClient(WebViewImpl* webView) 44 WebInspectorClient::WebInspectorClient(WebViewImpl* webView)
45 : inspected_web_view_(webView) 45 : inspected_web_view_(webView) {
46 , inspector_web_view_(0) {
47 ASSERT(inspected_web_view_); 46 ASSERT(inspected_web_view_);
48 } 47 }
49 48
50 WebInspectorClient::~WebInspectorClient() { 49 WebInspectorClient::~WebInspectorClient() {
51 } 50 }
52 51
53 void WebInspectorClient::inspectorDestroyed() { 52 void WebInspectorClient::inspectorDestroyed() {
54 delete this; 53 delete this;
55 } 54 }
56 55
57 Page* WebInspectorClient::createPage() { 56 Page* WebInspectorClient::createPage() {
58 if (inspected_web_view_->GetWebDevToolsAgentImpl()) 57 // This method should never be called in Chrome as inspector front-end lives
59 return NULL; 58 // in a separate process.
60 59 NOTREACHED();
61 WebCore::Page* page; 60 return NULL;
62
63 if (inspector_web_view_ != NULL) {
64 page = inspector_web_view_->page();
65 ASSERT(page != NULL);
66 if (page != NULL)
67 return page;
68 }
69
70 WebViewDelegate* delegate = inspected_web_view_->GetDelegate();
71 if (!delegate)
72 return NULL;
73 inspector_web_view_ = static_cast<WebViewImpl*>(
74 delegate->CreateWebView(inspected_web_view_, true, GURL()));
75 if (!inspector_web_view_)
76 return NULL;
77
78 inspector_web_view_->main_frame()->loadRequest(
79 WebURLRequest(webkit_glue::GetInspectorURL()));
80
81 page = inspector_web_view_->page();
82
83 page->chrome()->setToolbarsVisible(false);
84 page->chrome()->setStatusbarVisible(false);
85 page->chrome()->setScrollbarsVisible(false);
86 page->chrome()->setMenubarVisible(false);
87 page->chrome()->setResizable(true);
88
89 // Don't allow inspection of inspector.
90 page->settings()->setDeveloperExtrasEnabled(false);
91 page->settings()->setPrivateBrowsingEnabled(true);
92 page->settings()->setPluginsEnabled(false);
93 page->settings()->setJavaEnabled(false);
94
95 FloatRect windowRect = page->chrome()->windowRect();
96 FloatSize pageSize = page->chrome()->pageRect().size();
97 windowRect.setX(kDefaultInspectorXPos);
98 windowRect.setY(kDefaultInspectorYPos);
99 windowRect.setWidth(kDefaultInspectorHeight);
100 windowRect.setHeight(kDefaultInspectorWidth);
101 page->chrome()->setWindowRect(windowRect);
102
103 page->chrome()->show();
104
105 return page;
106 } 61 }
107 62
108 void WebInspectorClient::showWindow() { 63 void WebInspectorClient::showWindow() {
109 if (inspected_web_view_->GetWebDevToolsAgentImpl()) 64 DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
110 return; 65 InspectorController* inspector =
111 66 inspected_web_view_->page()->inspectorController();
112 InspectorController* inspector = inspected_web_view_->page()->inspectorControl ler();
113 inspector->setWindowVisible(true); 67 inspector->setWindowVisible(true);
114
115 // Notify the webview delegate of how many resources we're inspecting.
116 WebViewDelegate* d = inspected_web_view_->delegate();
117 DCHECK(d);
118 } 68 }
119 69
120 void WebInspectorClient::closeWindow() { 70 void WebInspectorClient::closeWindow() {
121 if (inspected_web_view_->GetWebDevToolsAgentImpl()) 71 DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
122 return;
123
124 inspector_web_view_ = NULL;
125
126 hideHighlight();
127
128 if (inspected_web_view_->page()) 72 if (inspected_web_view_->page())
129 inspected_web_view_->page()->inspectorController()->setWindowVisible(false); 73 inspected_web_view_->page()->inspectorController()->setWindowVisible(false);
130 } 74 }
131 75
132 bool WebInspectorClient::windowVisible() { 76 bool WebInspectorClient::windowVisible() {
133 if (inspected_web_view_->GetWebDevToolsAgentImpl()) 77 DCHECK(inspected_web_view_->GetWebDevToolsAgentImpl());
134 return false;
135
136 if (inspector_web_view_ != NULL) {
137 Page* page = inspector_web_view_->page();
138 ASSERT(page != NULL);
139 if (page != NULL)
140 return true;
141 }
142 return false; 78 return false;
143 } 79 }
144 80
145 void WebInspectorClient::attachWindow() { 81 void WebInspectorClient::attachWindow() {
146 // TODO(jackson): Implement this 82 // TODO(jackson): Implement this
147 } 83 }
148 84
149 void WebInspectorClient::detachWindow() { 85 void WebInspectorClient::detachWindow() {
150 // TODO(jackson): Implement this 86 // TODO(jackson): Implement this
151 } 87 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 default: 229 default:
294 NOTREACHED(); 230 NOTREACHED();
295 break; 231 break;
296 } 232 }
297 data.append(entry); 233 data.append(entry);
298 data.append("\n"); 234 data.append("\n");
299 } 235 }
300 inspected_web_view_->delegate()->UpdateInspectorSettings( 236 inspected_web_view_->delegate()->UpdateInspectorSettings(
301 webkit_glue::StringToStdWString(data)); 237 webkit_glue::StringToStdWString(data));
302 } 238 }
OLDNEW
« no previous file with comments | « webkit/glue/inspector_client_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698