| OLD | NEW |
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Notify the webview delegate of how many resources we're inspecting. | 98 // Notify the webview delegate of how many resources we're inspecting. |
| 99 WebViewDelegate* d = inspected_web_view_->delegate(); | 99 WebViewDelegate* d = inspected_web_view_->delegate(); |
| 100 DCHECK(d); | 100 DCHECK(d); |
| 101 d->WebInspectorOpened(inspector->resources().size()); | 101 d->WebInspectorOpened(inspector->resources().size()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void WebInspectorClient::closeWindow() { | 104 void WebInspectorClient::closeWindow() { |
| 105 inspector_web_view_ = NULL; | 105 inspector_web_view_ = NULL; |
| 106 WebFrameImpl* frame = inspected_web_view_->main_frame(); | 106 WebFrameImpl* frame = inspected_web_view_->main_frame(); |
| 107 | 107 |
| 108 if (frame && frame->inspected_node()) | 108 if (inspected_node_) |
| 109 hideHighlight(); | 109 hideHighlight(); |
| 110 | 110 |
| 111 if (inspected_web_view_->page()) | 111 if (inspected_web_view_->page()) |
| 112 inspected_web_view_->page()->inspectorController()->setWindowVisible(false); | 112 inspected_web_view_->page()->inspectorController()->setWindowVisible(false); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool WebInspectorClient::windowVisible() { | 115 bool WebInspectorClient::windowVisible() { |
| 116 if (inspector_web_view_ != NULL) { | 116 if (inspector_web_view_ != NULL) { |
| 117 Page* page = inspector_web_view_->page(); | 117 Page* page = inspector_web_view_->page(); |
| 118 ASSERT(page != NULL); | 118 ASSERT(page != NULL); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 138 static void invalidateNodeBoundingRect(WebViewImpl* web_view) { | 138 static void invalidateNodeBoundingRect(WebViewImpl* web_view) { |
| 139 // TODO(ojan): http://b/1143996 Is it important to just invalidate the rect | 139 // TODO(ojan): http://b/1143996 Is it important to just invalidate the rect |
| 140 // of the node region given that this is not on a critical codepath? | 140 // of the node region given that this is not on a critical codepath? |
| 141 // In order to do so, we'd have to take scrolling into account. | 141 // In order to do so, we'd have to take scrolling into account. |
| 142 gfx::Size size = web_view->size(); | 142 gfx::Size size = web_view->size(); |
| 143 gfx::Rect damaged_rect(0, 0, size.width(), size.height()); | 143 gfx::Rect damaged_rect(0, 0, size.width(), size.height()); |
| 144 web_view->GetDelegate()->DidInvalidateRect(web_view, damaged_rect); | 144 web_view->GetDelegate()->DidInvalidateRect(web_view, damaged_rect); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WebInspectorClient::highlight(Node* node) { | 147 void WebInspectorClient::highlight(Node* node) { |
| 148 WebFrameImpl* frame = inspected_web_view_->main_frame(); | 148 if (inspected_node_) |
| 149 | |
| 150 if (frame->inspected_node()) | |
| 151 hideHighlight(); | 149 hideHighlight(); |
| 152 | 150 |
| 151 inspected_node_ = node; |
| 153 invalidateNodeBoundingRect(inspected_web_view_); | 152 invalidateNodeBoundingRect(inspected_web_view_); |
| 154 frame->selectNodeFromInspector(node); | |
| 155 } | 153 } |
| 156 | 154 |
| 157 void WebInspectorClient::hideHighlight() { | 155 void WebInspectorClient::hideHighlight() { |
| 158 WebFrameImpl* frame = static_cast<WebFrameImpl*>(inspected_web_view_->GetMainF
rame()); | 156 inspected_node_ = 0; |
| 159 | |
| 160 invalidateNodeBoundingRect(inspected_web_view_); | 157 invalidateNodeBoundingRect(inspected_web_view_); |
| 161 frame->selectNodeFromInspector(NULL); | |
| 162 } | 158 } |
| 163 | 159 |
| 164 void WebInspectorClient::inspectedURLChanged(const String& newURL) { | 160 void WebInspectorClient::inspectedURLChanged(const String& newURL) { |
| 165 // TODO(jackson): Implement this | 161 // TODO(jackson): Implement this |
| 166 } | 162 } |
| 167 | 163 |
| 168 String WebInspectorClient::localizedStringsURL() { | 164 String WebInspectorClient::localizedStringsURL() { |
| 169 NOTIMPLEMENTED(); | 165 NOTIMPLEMENTED(); |
| 170 return String(); | 166 return String(); |
| 171 } | 167 } |
| 172 | 168 |
| 173 String WebInspectorClient::hiddenPanels() { | 169 String WebInspectorClient::hiddenPanels() { |
| 174 NOTIMPLEMENTED(); | 170 NOTIMPLEMENTED(); |
| 175 return String(); | 171 return String(); |
| 176 } | 172 } |
| 177 | 173 |
| 178 void WebInspectorClient::populateSetting( | 174 void WebInspectorClient::populateSetting( |
| 179 const String& key, InspectorController::Setting&) { | 175 const String& key, InspectorController::Setting&) { |
| 180 NOTIMPLEMENTED(); | 176 NOTIMPLEMENTED(); |
| 181 } | 177 } |
| 182 | 178 |
| 183 void WebInspectorClient::storeSetting( | 179 void WebInspectorClient::storeSetting( |
| 184 const String& key, const InspectorController::Setting&) { | 180 const String& key, const InspectorController::Setting&) { |
| 185 NOTIMPLEMENTED(); | 181 NOTIMPLEMENTED(); |
| 186 } | 182 } |
| 187 | 183 |
| 188 void WebInspectorClient::removeSetting(const String& key) { | 184 void WebInspectorClient::removeSetting(const String& key) { |
| 189 NOTIMPLEMENTED(); | 185 NOTIMPLEMENTED(); |
| 190 } | 186 } |
| OLD | NEW |