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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_error_handler.cc

Issue 108213012: [DevTools] Remove dock side knowledge from browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More test magic Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/webui/extensions/extension_error_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_error_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 content::RenderViewHost* rvh = 192 content::RenderViewHost* rvh =
193 content::RenderViewHost::FromID(render_process_id, render_view_id); 193 content::RenderViewHost::FromID(render_process_id, render_view_id);
194 194
195 // It's possible that the render view was closed since we last updated the 195 // It's possible that the render view was closed since we last updated the
196 // links. Handle this gracefully. 196 // links. Handle this gracefully.
197 if (!rvh) 197 if (!rvh)
198 return; 198 return;
199 199
200 // Check if we already have an inspector for the given RenderViewHost. If not,
201 // create one.
202 DevToolsWindow* window =
203 DevToolsWindow::GetInstanceForInspectedRenderViewHost(rvh);
204 if (!window)
205 window = DevToolsWindow::OpenDevToolsWindow(rvh);
206
207 // If we include a url, we should inspect it specifically (and not just the 200 // If we include a url, we should inspect it specifically (and not just the
208 // render view). 201 // render view).
209 base::string16 url; 202 base::string16 url;
210 if (dict->GetString(RuntimeError::kUrlKey, &url)) { 203 if (dict->GetString(RuntimeError::kUrlKey, &url)) {
211 // Line and column numbers are optional; default to the first line. 204 // Line and column numbers are optional; default to the first line.
212 int line_number = 1; 205 int line_number = 1;
213 int column_number = 1; 206 int column_number = 1;
214 dict->GetInteger(RuntimeError::kLineNumberKey, &line_number); 207 dict->GetInteger(RuntimeError::kLineNumberKey, &line_number);
215 dict->GetInteger(RuntimeError::kColumnNumberKey, &column_number); 208 dict->GetInteger(RuntimeError::kColumnNumberKey, &column_number);
216 209
217 // Line/column numbers are reported in display-friendly 1-based numbers, 210 // Line/column numbers are reported in display-friendly 1-based numbers,
218 // but are inspected in zero-based numbers. 211 // but are inspected in zero-based numbers.
219 window->Show( 212 DevToolsWindow::OpenDevToolsWindow(rvh,
220 DevToolsToggleAction::Reveal(url, line_number - 1, column_number - 1)); 213 DevToolsToggleAction::Reveal(url, line_number - 1, column_number - 1));
214 } else {
215 DevToolsWindow::OpenDevToolsWindow(rvh);
221 } 216 }
222 217
223 // Once we open the inspector, we focus on the appropriate tab... 218 // Once we open the inspector, we focus on the appropriate tab...
224 content::WebContents* web_contents = 219 content::WebContents* web_contents =
225 content::WebContents::FromRenderViewHost(rvh); 220 content::WebContents::FromRenderViewHost(rvh);
226 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 221 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
227 // ... but background pages have no associated browser (and the inspector 222 // ... but background pages have no associated browser (and the inspector
228 // opens in its own window), so our work is done. 223 // opens in its own window), so our work is done.
229 if (!browser) 224 if (!browser)
230 return; 225 return;
(...skipping 18 matching lines...) Expand all
249 base::DictionaryValue* results, 244 base::DictionaryValue* results,
250 int line_number, 245 int line_number,
251 const std::string& contents) { 246 const std::string& contents) {
252 SourceHighlighter highlighter(contents, line_number); 247 SourceHighlighter highlighter(contents, line_number);
253 highlighter.SetHighlightedRegions(results); 248 highlighter.SetHighlightedRegions(results);
254 web_ui()->CallJavascriptFunction( 249 web_ui()->CallJavascriptFunction(
255 "extensions.ExtensionErrorOverlay.requestFileSourceResponse", *results); 250 "extensions.ExtensionErrorOverlay.requestFileSourceResponse", *results);
256 } 251 }
257 252
258 } // namespace extensions 253 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698