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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 12528011: Rebind frontend host when frontend renderer navigates to devtools url. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new line Created 7 years, 9 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 extensions::APIPermission::kExperimental); 491 extensions::APIPermission::kExperimental);
492 extension_info->Set("exposeExperimentalAPIs", 492 extension_info->Set("exposeExperimentalAPIs",
493 new base::FundamentalValue(allow_experimental)); 493 new base::FundamentalValue(allow_experimental));
494 results.Append(extension_info); 494 results.Append(extension_info);
495 } 495 }
496 CallClientFunction("WebInspector.addExtensions", &results); 496 CallClientFunction("WebInspector.addExtensions", &results);
497 } 497 }
498 498
499 WebContents* DevToolsWindow::OpenURLFromTab(WebContents* source, 499 WebContents* DevToolsWindow::OpenURLFromTab(WebContents* source,
500 const OpenURLParams& params) { 500 const OpenURLParams& params) {
501 if (params.url.SchemeIs(chrome::kChromeDevToolsScheme)) { 501 if (!params.url.SchemeIs(chrome::kChromeDevToolsScheme)) {
502 chrome::NavigateParams nav_params(profile_, params.url, params.transition); 502 if (inspected_web_contents_)
503 FillNavigateParamsFromOpenURLParams(&nav_params, params); 503 return inspected_web_contents_->OpenURL(params);
504 nav_params.source_contents = source; 504 return NULL;
505 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE;
506 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
507 nav_params.user_gesture = true;
508 chrome::Navigate(&nav_params);
509 return nav_params.target_contents;
510 } 505 }
511 506
512 if (inspected_web_contents_) 507 DevToolsManager* manager = DevToolsManager::GetInstance();
513 return inspected_web_contents_->OpenURL(params); 508 scoped_refptr<DevToolsAgentHost> agent_host(
514 return NULL; 509 manager->GetDevToolsAgentHostFor(frontend_host_.get()));
510 if (!agent_host)
511 return NULL;
512 manager->ClientHostClosing(frontend_host_.get());
513 manager->RegisterDevToolsClientHostFor(agent_host, frontend_host_.get());
514
515 chrome::NavigateParams nav_params(profile_, params.url, params.transition);
516 FillNavigateParamsFromOpenURLParams(&nav_params, params);
517 nav_params.source_contents = source;
518 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE;
519 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
520 nav_params.user_gesture = true;
521 chrome::Navigate(&nav_params);
522 return nav_params.target_contents;
515 } 523 }
516 524
517 void DevToolsWindow::CallClientFunction(const std::string& function_name, 525 void DevToolsWindow::CallClientFunction(const std::string& function_name,
518 const Value* arg1, 526 const Value* arg1,
519 const Value* arg2) { 527 const Value* arg2) {
520 std::string params; 528 std::string params;
521 if (arg1) { 529 if (arg1) {
522 std::string json; 530 std::string json;
523 base::JSONWriter::Write(arg1, &json); 531 base::JSONWriter::Write(arg1, &json);
524 params.append(json); 532 params.append(json);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1008
1001 // static 1009 // static
1002 DevToolsDockSide DevToolsWindow::SideFromString( 1010 DevToolsDockSide DevToolsWindow::SideFromString(
1003 const std::string& dock_side) { 1011 const std::string& dock_side) {
1004 if (dock_side == kDockSideRight) 1012 if (dock_side == kDockSideRight)
1005 return DEVTOOLS_DOCK_SIDE_RIGHT; 1013 return DEVTOOLS_DOCK_SIDE_RIGHT;
1006 if (dock_side == kDockSideBottom) 1014 if (dock_side == kDockSideBottom)
1007 return DEVTOOLS_DOCK_SIDE_BOTTOM; 1015 return DEVTOOLS_DOCK_SIDE_BOTTOM;
1008 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 1016 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
1009 } 1017 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698