| OLD | NEW |
| 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 <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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 RenderViewHost* inspected_rvh, | 156 RenderViewHost* inspected_rvh, |
| 157 bool docked, | 157 bool docked, |
| 158 bool shared_worker_frontend) { | 158 bool shared_worker_frontend) { |
| 159 // Create TabContents with devtools. | 159 // Create TabContents with devtools. |
| 160 TabContentsWrapper* tab_contents = | 160 TabContentsWrapper* tab_contents = |
| 161 Browser::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); | 161 Browser::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); |
| 162 tab_contents->render_view_host()->AllowBindings( | 162 tab_contents->render_view_host()->AllowBindings( |
| 163 content::BINDINGS_POLICY_WEB_UI); | 163 content::BINDINGS_POLICY_WEB_UI); |
| 164 tab_contents->controller().LoadURL( | 164 tab_contents->controller().LoadURL( |
| 165 GetDevToolsUrl(profile, docked, shared_worker_frontend), | 165 GetDevToolsUrl(profile, docked, shared_worker_frontend), |
| 166 GURL(), | 166 content::Referrer(), |
| 167 content::PAGE_TRANSITION_START_PAGE, | 167 content::PAGE_TRANSITION_START_PAGE, |
| 168 std::string()); | 168 std::string()); |
| 169 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); | 169 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); |
| 170 } | 170 } |
| 171 | 171 |
| 172 DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, | 172 DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, |
| 173 Profile* profile, | 173 Profile* profile, |
| 174 RenderViewHost* inspected_rvh, | 174 RenderViewHost* inspected_rvh, |
| 175 bool docked) | 175 bool docked) |
| 176 : profile_(profile), | 176 : profile_(profile), |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 continue; | 422 continue; |
| 423 DictionaryValue* extension_info = new DictionaryValue(); | 423 DictionaryValue* extension_info = new DictionaryValue(); |
| 424 extension_info->Set("startPage", | 424 extension_info->Set("startPage", |
| 425 new StringValue((*extension)->devtools_url().spec())); | 425 new StringValue((*extension)->devtools_url().spec())); |
| 426 extension_info->Set("name", new StringValue((*extension)->name())); | 426 extension_info->Set("name", new StringValue((*extension)->name())); |
| 427 results.Append(extension_info); | 427 results.Append(extension_info); |
| 428 } | 428 } |
| 429 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); | 429 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // TODO(adriansc): Remove this method once refactoring changed all call sites. | |
| 433 TabContents* DevToolsWindow::OpenURLFromTab( | |
| 434 TabContents* source, | |
| 435 const GURL& url, | |
| 436 const GURL& referrer, | |
| 437 WindowOpenDisposition disposition, | |
| 438 content::PageTransition transition) { | |
| 439 return OpenURLFromTab(source, | |
| 440 OpenURLParams(url, referrer, disposition, transition, | |
| 441 false)); | |
| 442 } | |
| 443 | |
| 444 TabContents* DevToolsWindow::OpenURLFromTab(TabContents* source, | 432 TabContents* DevToolsWindow::OpenURLFromTab(TabContents* source, |
| 445 const OpenURLParams& params) { | 433 const OpenURLParams& params) { |
| 446 if (inspected_tab_) { | 434 if (inspected_tab_) { |
| 447 OpenURLParams forward_params = params; | 435 OpenURLParams forward_params = params; |
| 448 forward_params.disposition = NEW_FOREGROUND_TAB; | 436 forward_params.disposition = NEW_FOREGROUND_TAB; |
| 449 forward_params.transition = content::PAGE_TRANSITION_LINK; | 437 forward_params.transition = content::PAGE_TRANSITION_LINK; |
| 450 return inspected_tab_->tab_contents()->OpenURL(forward_params); | 438 return inspected_tab_->tab_contents()->OpenURL(forward_params); |
| 451 } | 439 } |
| 452 return NULL; | 440 return NULL; |
| 453 } | 441 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 content); | 671 content); |
| 684 } | 672 } |
| 685 | 673 |
| 686 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 674 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
| 687 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 675 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
| 688 return inspected_tab_->tab_contents()->delegate()-> | 676 return inspected_tab_->tab_contents()->delegate()-> |
| 689 GetJavaScriptDialogCreator(); | 677 GetJavaScriptDialogCreator(); |
| 690 } | 678 } |
| 691 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 679 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
| 692 } | 680 } |
| OLD | NEW |