OLD | NEW |
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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 forward_params.disposition = NEW_FOREGROUND_TAB; | 463 forward_params.disposition = NEW_FOREGROUND_TAB; |
464 forward_params.transition = content::PAGE_TRANSITION_LINK; | 464 forward_params.transition = content::PAGE_TRANSITION_LINK; |
465 return inspected_tab_->web_contents()->OpenURL(forward_params); | 465 return inspected_tab_->web_contents()->OpenURL(forward_params); |
466 } | 466 } |
467 return NULL; | 467 return NULL; |
468 } | 468 } |
469 | 469 |
470 void DevToolsWindow::CallClientFunction(const string16& function_name, | 470 void DevToolsWindow::CallClientFunction(const string16& function_name, |
471 const Value& arg) { | 471 const Value& arg) { |
472 std::string json; | 472 std::string json; |
473 base::JSONWriter::Write(&arg, false, &json); | 473 base::JSONWriter::Write(&arg, &json); |
474 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + | 474 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + |
475 ASCIIToUTF16(");"); | 475 ASCIIToUTF16(");"); |
476 tab_contents_->web_contents()->GetRenderViewHost()-> | 476 tab_contents_->web_contents()->GetRenderViewHost()-> |
477 ExecuteJavascriptInWebFrame(string16(), javascript); | 477 ExecuteJavascriptInWebFrame(string16(), javascript); |
478 } | 478 } |
479 | 479 |
480 void DevToolsWindow::Observe(int type, | 480 void DevToolsWindow::Observe(int type, |
481 const content::NotificationSource& source, | 481 const content::NotificationSource& source, |
482 const content::NotificationDetails& details) { | 482 const content::NotificationDetails& details) { |
483 if (type == content::NOTIFICATION_LOAD_STOP && !is_loaded_) { | 483 if (type == content::NOTIFICATION_LOAD_STOP && !is_loaded_) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 content); | 744 content); |
745 } | 745 } |
746 | 746 |
747 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 747 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
748 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { | 748 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { |
749 return inspected_tab_->web_contents()->GetDelegate()-> | 749 return inspected_tab_->web_contents()->GetDelegate()-> |
750 GetJavaScriptDialogCreator(); | 750 GetJavaScriptDialogCreator(); |
751 } | 751 } |
752 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); | 752 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); |
753 } | 753 } |
OLD | NEW |