OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/public/browser/render_frame_host.h" | 42 #include "content/public/browser/render_frame_host.h" |
43 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
44 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
45 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
46 #include "content/public/browser/web_contents_observer.h" | 46 #include "content/public/browser/web_contents_observer.h" |
47 #include "content/public/common/page_transition_types.h" | 47 #include "content/public/common/page_transition_types.h" |
48 #include "content/public/common/renderer_preferences.h" | 48 #include "content/public/common/renderer_preferences.h" |
49 #include "content/public/common/url_constants.h" | 49 #include "content/public/common/url_constants.h" |
50 #include "extensions/browser/extension_system.h" | 50 #include "extensions/browser/extension_system.h" |
51 #include "extensions/common/extension_set.h" | 51 #include "extensions/common/extension_set.h" |
| 52 #include "extensions/common/permissions/permissions_data.h" |
52 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
53 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
54 | 55 |
55 using base::DictionaryValue; | 56 using base::DictionaryValue; |
56 using content::BrowserThread; | 57 using content::BrowserThread; |
57 | 58 |
58 namespace { | 59 namespace { |
59 | 60 |
60 static const char kFrontendHostId[] = "id"; | 61 static const char kFrontendHostId[] = "id"; |
61 static const char kFrontendHostMethod[] = "method"; | 62 static const char kFrontendHostMethod[] = "method"; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 extension != extensions->end(); ++extension) { | 751 extension != extensions->end(); ++extension) { |
751 if (extensions::ManifestURL::GetDevToolsPage(extension->get()).is_empty()) | 752 if (extensions::ManifestURL::GetDevToolsPage(extension->get()).is_empty()) |
752 continue; | 753 continue; |
753 base::DictionaryValue* extension_info = new base::DictionaryValue(); | 754 base::DictionaryValue* extension_info = new base::DictionaryValue(); |
754 extension_info->Set( | 755 extension_info->Set( |
755 "startPage", | 756 "startPage", |
756 new base::StringValue( | 757 new base::StringValue( |
757 extensions::ManifestURL::GetDevToolsPage( | 758 extensions::ManifestURL::GetDevToolsPage( |
758 extension->get()).spec())); | 759 extension->get()).spec())); |
759 extension_info->Set("name", new base::StringValue((*extension)->name())); | 760 extension_info->Set("name", new base::StringValue((*extension)->name())); |
760 extension_info->Set( | 761 extension_info->Set("exposeExperimentalAPIs", |
761 "exposeExperimentalAPIs", | 762 new base::FundamentalValue( |
762 new base::FundamentalValue((*extension)->HasAPIPermission( | 763 (*extension)->permissions_data()->HasAPIPermission( |
763 extensions::APIPermission::kExperimental))); | 764 extensions::APIPermission::kExperimental))); |
764 results.Append(extension_info); | 765 results.Append(extension_info); |
765 } | 766 } |
766 CallClientFunction("WebInspector.addExtensions", &results, NULL, NULL); | 767 CallClientFunction("WebInspector.addExtensions", &results, NULL, NULL); |
767 } | 768 } |
768 | 769 |
769 void DevToolsUIBindings::SetDelegate(Delegate* delegate) { | 770 void DevToolsUIBindings::SetDelegate(Delegate* delegate) { |
770 delegate_.reset(delegate); | 771 delegate_.reset(delegate); |
771 } | 772 } |
772 | 773 |
773 void DevToolsUIBindings::CallClientFunction(const std::string& function_name, | 774 void DevToolsUIBindings::CallClientFunction(const std::string& function_name, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 NULL); | 806 NULL); |
806 } | 807 } |
807 | 808 |
808 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { | 809 void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
809 // Call delegate first - it seeds importants bit of information. | 810 // Call delegate first - it seeds importants bit of information. |
810 delegate_->OnLoadCompleted(); | 811 delegate_->OnLoadCompleted(); |
811 | 812 |
812 UpdateTheme(); | 813 UpdateTheme(); |
813 AddDevToolsExtensionsToClient(); | 814 AddDevToolsExtensionsToClient(); |
814 } | 815 } |
OLD | NEW |