| 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 "chrome/browser/extensions/api/mdns/mdns_api.h" | 5 #include "chrome/browser/extensions/api/mdns/mdns_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/values.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_service_test_base.h" | 16 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 16 #include "chrome/browser/extensions/test_extension_system.h" | 17 #include "chrome/browser/extensions/test_extension_system.h" |
| 17 #include "chrome/common/extensions/api/mdns.h" | 18 #include "chrome/common/extensions/api/mdns.h" |
| 18 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 19 #include "content/public/test/mock_render_process_host.h" | 20 #include "content/public/test/mock_render_process_host.h" |
| 20 #include "extensions/browser/event_listener_map.h" | 21 #include "extensions/browser/event_listener_map.h" |
| 21 #include "extensions/browser/event_router_factory.h" | 22 #include "extensions/browser/event_router_factory.h" |
| 22 #include "extensions/browser/extension_prefs.h" | 23 #include "extensions/browser/extension_prefs.h" |
| 23 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 std::string name, | 239 std::string name, |
| 239 bool is_platform_app, | 240 bool is_platform_app, |
| 240 std::string extension_id) { | 241 std::string extension_id) { |
| 241 base::DictionaryValue manifest; | 242 base::DictionaryValue manifest; |
| 242 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); | 243 manifest.SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); |
| 243 manifest.SetString(extensions::manifest_keys::kName, name); | 244 manifest.SetString(extensions::manifest_keys::kName, name); |
| 244 if (is_platform_app) { | 245 if (is_platform_app) { |
| 245 // Setting app.background.page = "background.html" is sufficient to make | 246 // Setting app.background.page = "background.html" is sufficient to make |
| 246 // the extension type TYPE_PLATFORM_APP. | 247 // the extension type TYPE_PLATFORM_APP. |
| 247 manifest.Set(extensions::manifest_keys::kPlatformAppBackgroundPage, | 248 manifest.Set(extensions::manifest_keys::kPlatformAppBackgroundPage, |
| 248 new base::Value("background.html")); | 249 base::MakeUnique<base::Value>("background.html")); |
| 249 } | 250 } |
| 250 | 251 |
| 251 std::string error; | 252 std::string error; |
| 252 return extensions::Extension::Create( | 253 return extensions::Extension::Create( |
| 253 bogus_file_pathname(name), | 254 bogus_file_pathname(name), |
| 254 extensions::Manifest::INVALID_LOCATION, | 255 extensions::Manifest::INVALID_LOCATION, |
| 255 manifest, | 256 manifest, |
| 256 Extension::NO_FLAGS, | 257 Extension::NO_FLAGS, |
| 257 extension_id, | 258 extension_id, |
| 258 &error); | 259 &error); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 render_process_host(), kExtId, filter, false); | 437 render_process_host(), kExtId, filter, false); |
| 437 | 438 |
| 438 EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local")); | 439 EXPECT_CALL(*dns_sd_registry(), UnregisterDnsSdListener("_trex._tcp.local")); |
| 439 EventRouter::Get(browser_context()) | 440 EventRouter::Get(browser_context()) |
| 440 ->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName, | 441 ->RemoveFilteredEventListener(api::mdns::OnServiceList::kEventName, |
| 441 render_process_host(), kExtId, filter, | 442 render_process_host(), kExtId, filter, |
| 442 false); | 443 false); |
| 443 } | 444 } |
| 444 | 445 |
| 445 } // namespace extensions | 446 } // namespace extensions |
| OLD | NEW |