OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/browser/headless_content_browser_client.h" | 5 #include "headless/lib/browser/headless_content_browser_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <unordered_set> | 8 #include <unordered_set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 callback.Run(prefs); | 54 callback.Run(prefs); |
55 } | 55 } |
56 | 56 |
57 content::DevToolsManagerDelegate* | 57 content::DevToolsManagerDelegate* |
58 HeadlessContentBrowserClient::GetDevToolsManagerDelegate() { | 58 HeadlessContentBrowserClient::GetDevToolsManagerDelegate() { |
59 return new HeadlessDevToolsManagerDelegate(browser_->GetWeakPtr()); | 59 return new HeadlessDevToolsManagerDelegate(browser_->GetWeakPtr()); |
60 } | 60 } |
61 | 61 |
62 std::unique_ptr<base::Value> | 62 std::unique_ptr<base::Value> |
63 HeadlessContentBrowserClient::GetServiceManifestOverlay( | 63 HeadlessContentBrowserClient::GetServiceManifestOverlay( |
64 const std::string& name) { | 64 base::StringPiece name) { |
65 if (name != content::mojom::kBrowserServiceName || | 65 if (name != content::mojom::kBrowserServiceName || |
66 browser_->options()->mojo_service_names.empty()) | 66 browser_->options()->mojo_service_names.empty()) |
67 return nullptr; | 67 return nullptr; |
68 | 68 |
69 base::StringPiece manifest_template = | 69 base::StringPiece manifest_template = |
70 ui::ResourceBundle::GetSharedInstance().GetRawDataResource( | 70 ui::ResourceBundle::GetSharedInstance().GetRawDataResource( |
71 IDR_HEADLESS_BROWSER_MANIFEST_OVERLAY_TEMPLATE); | 71 IDR_HEADLESS_BROWSER_MANIFEST_OVERLAY_TEMPLATE); |
72 std::unique_ptr<base::Value> manifest = | 72 std::unique_ptr<base::Value> manifest = |
73 base::JSONReader::Read(manifest_template); | 73 base::JSONReader::Read(manifest_template); |
74 | 74 |
75 // Add mojo_service_names to renderer capability specified in options. | 75 // Add mojo_service_names to renderer capability specified in options. |
76 base::DictionaryValue* manifest_dictionary = nullptr; | 76 base::DictionaryValue* manifest_dictionary = nullptr; |
77 CHECK(manifest->GetAsDictionary(&manifest_dictionary)); | 77 CHECK(manifest->GetAsDictionary(&manifest_dictionary)); |
78 | 78 |
79 base::ListValue* capability_list = nullptr; | 79 base::ListValue* capability_list = nullptr; |
80 CHECK(manifest_dictionary->GetList(kCapabilityPath, &capability_list)); | 80 CHECK(manifest_dictionary->GetList(kCapabilityPath, &capability_list)); |
81 | 81 |
82 for (std::string service_name : browser_->options()->mojo_service_names) { | 82 for (std::string service_name : browser_->options()->mojo_service_names) { |
83 capability_list->AppendString(service_name); | 83 capability_list->AppendString(service_name); |
84 } | 84 } |
85 | 85 |
86 return manifest; | 86 return manifest; |
87 } | 87 } |
88 | 88 |
89 } // namespace headless | 89 } // namespace headless |
OLD | NEW |