Commit 4d166378 authored by thestig@chromium.org's avatar thestig@chromium.org

Extensions: Move bluetooth APIs to extensions/.

BUG=395240

Review URL: https://codereview.chromium.org/395333003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285687 0039d316-1c4b-4281-b951-d872f2087c98
parent dfc0424c
......@@ -33,7 +33,6 @@ static_library("extensions") {
"//chrome:resources",
"//chrome:strings",
"//chrome/app/resources:platform_locale_settings",
"//chrome/browser/extensions/api/cast_channel:cast_channel_proto",
"//chrome/app/theme:theme_resources",
"//chrome/browser/history:in_memory_url_index_cache_proto",
"//chrome/browser/sync_file_system:sync_file_system_proto",
......@@ -202,13 +201,6 @@ static_library("extensions") {
sources += [ "api/system_display/display_info_provider_aura.cc" ]
}
if (use_openssl) {
sources += [ "api/cast_channel/cast_auth_util_openssl.cc" ]
} else {
# cast_auth_util_nss.cc uses NSS functions.
sources += [ "api/cast_channel/cast_auth_util_nss.cc" ]
}
if (is_android) {
sources += rebase_path(
gypi_values.chrome_browser_extensions_android_sources,
......
......@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/url_request_util.h"
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_paths.h"
......@@ -263,6 +264,10 @@ ChromeExtensionsBrowserClient::GetComponentExtensionResourceManager() {
return resource_manager_.get();
}
net::NetLog* ChromeExtensionsBrowserClient::GetNetLog() {
return g_browser_process->net_log();
}
scoped_ptr<extensions::RuntimeAPIDelegate>
ChromeExtensionsBrowserClient::CreateRuntimeAPIDelegate(
content::BrowserContext* context) const {
......
......@@ -92,6 +92,7 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) const OVERRIDE;
virtual ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() OVERRIDE;
virtual net::NetLog* GetNetLog() OVERRIDE;
private:
friend struct base::DefaultLazyInstanceTraits<ChromeExtensionsBrowserClient>;
......
......@@ -450,13 +450,6 @@
'browser/extensions/api/browsing_data/browsing_data_api.h',
'browser/extensions/api/capture_web_contents_function.cc',
'browser/extensions/api/capture_web_contents_function.h',
'browser/extensions/api/cast_channel/cast_auth_util.h',
'browser/extensions/api/cast_channel/cast_channel_api.cc',
'browser/extensions/api/cast_channel/cast_channel_api.h',
'browser/extensions/api/cast_channel/cast_message_util.cc',
'browser/extensions/api/cast_channel/cast_message_util.h',
'browser/extensions/api/cast_channel/cast_socket.cc',
'browser/extensions/api/cast_channel/cast_socket.h',
'browser/extensions/api/chrome_extensions_api_client.cc',
'browser/extensions/api/chrome_extensions_api_client.h',
'browser/extensions/api/cloud_print_private/cloud_print_private_api.cc',
......@@ -570,12 +563,6 @@
'browser/extensions/api/gcm/gcm_api.h',
'browser/extensions/api/guest_view/guest_view_internal_api.cc',
'browser/extensions/api/guest_view/guest_view_internal_api.h',
'browser/extensions/api/hid/hid_api.cc',
'browser/extensions/api/hid/hid_api.h',
'browser/extensions/api/hid/hid_connection_resource.cc',
'browser/extensions/api/hid/hid_connection_resource.h',
'browser/extensions/api/hid/hid_device_manager.cc',
'browser/extensions/api/hid/hid_device_manager.h',
'browser/extensions/api/history/history_api.cc',
'browser/extensions/api/history/history_api.h',
'browser/extensions/api/hotword_private/hotword_private_api.cc',
......@@ -960,7 +947,6 @@
# have the same dependencies. Once browser_extensions is untangled from
# browser, then we can clean up these dependencies.
'dependencies': [
'cast_channel_proto',
'chrome_resources.gyp:chrome_extra_resources',
'chrome_resources.gyp:chrome_resources',
'chrome_resources.gyp:chrome_strings',
......@@ -1180,16 +1166,6 @@
'browser/extensions/api/system_display/display_info_provider_aura.cc',
],
}],
['use_openssl==1', {
'sources': [
'browser/extensions/api/cast_channel/cast_auth_util_openssl.cc',
],
}, {
'sources': [
# cast_auth_util_nss.cc uses NSS functions.
'browser/extensions/api/cast_channel/cast_auth_util_nss.cc',
],
}],
['OS=="android"', {
'sources': [
'<@(chrome_browser_extensions_android_sources)',
......@@ -1202,17 +1178,5 @@
}]
],
},
{
# Protobuf compiler / generator for chrome.cast.channel-related protocol buffers.
# GN version: //chrome/browser/extensions/api/cast_channel:cast_channel_proto
'target_name': 'cast_channel_proto',
'type': 'static_library',
'sources': [ 'browser/extensions/api/cast_channel/cast_channel.proto' ],
'variables': {
'proto_in_dir': 'browser/extensions/api/cast_channel',
'proto_out_dir': 'chrome/browser/extensions/api/cast_channel',
},
'includes': [ '../build/protoc.gypi' ]
},
],
}
......@@ -841,6 +841,7 @@
'../apps/app_shim/test/app_shim_host_manager_test_api_mac.cc',
'../apps/app_shim/test/app_shim_host_manager_test_api_mac.h',
'../apps/load_and_launch_browsertest.cc',
'../extensions/browser/api/cast_channel/cast_channel_apitest.cc',
'../extensions/browser/api/serial/serial_apitest.cc',
'../extensions/browser/api/usb/usb_apitest.cc',
'../extensions/browser/api/usb/usb_manual_apitest.cc',
......@@ -1060,7 +1061,6 @@
'browser/extensions/api/browser/browser_apitest.cc',
'browser/extensions/api/bookmarks/bookmark_apitest.cc',
'browser/extensions/api/browsing_data/browsing_data_test.cc',
'browser/extensions/api/cast_channel/cast_channel_apitest.cc',
'browser/extensions/api/cast_streaming/cast_streaming_apitest.cc',
'browser/extensions/api/cloud_print_private/cloud_print_private_apitest.cc',
'browser/extensions/api/command_line_private/command_line_private_apitest.cc',
......
......@@ -540,6 +540,8 @@
# they should be kept here.
'../extensions/browser/admin_policy_unittest.cc',
'../extensions/browser/api/api_resource_manager_unittest.cc',
'../extensions/browser/api/cast_channel/cast_channel_api_unittest.cc',
'../extensions/browser/api/cast_channel/cast_socket_unittest.cc',
'../extensions/browser/api/power/power_api_unittest.cc',
'../extensions/browser/api/storage/settings_quota_unittest.cc',
'../extensions/browser/api/storage/settings_test_util.cc',
......@@ -885,8 +887,6 @@
'browser/extensions/api/alarms/alarms_api_unittest.cc',
'browser/extensions/api/bluetooth/bluetooth_event_router_unittest.cc',
'browser/extensions/api/bookmarks/bookmark_api_helpers_unittest.cc',
'browser/extensions/api/cast_channel/cast_channel_api_unittest.cc',
'browser/extensions/api/cast_channel/cast_socket_unittest.cc',
'browser/extensions/api/content_settings/content_settings_store_unittest.cc',
'browser/extensions/api/content_settings/content_settings_unittest.cc',
'browser/extensions/api/cookies/cookies_unittest.cc',
......
......@@ -37,7 +37,6 @@
'bookmarks.json',
'braille_display_private.idl',
'browser.idl',
'cast_channel.idl',
'cloud_print_private.json',
'command_line_private.json',
'content_settings.json',
......@@ -65,7 +64,6 @@
'gcm.json',
'guest_view_internal.json',
'hangouts_private.idl',
'hid.idl',
'history.json',
'hotword_private.idl',
'i18n.json',
......
......@@ -4,8 +4,7 @@
import("//third_party/protobuf/proto_library.gni")
# GYP version: chrome/chrome_browser_extensions.gypi:cast_channel_proto
# GYP version: extensions/extensions.gyp:cast_channel_proto
proto_library("cast_channel_proto") {
sources = [ "cast_channel.proto" ]
}
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
#include <string>
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
class CastMessage;
......@@ -20,7 +20,7 @@ bool AuthenticateChallengeReply(const CastMessage& challenge_reply,
const std::string& peer_cert);
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_UTIL_H_
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_auth_util.h"
#include "extensions/browser/api/cast_channel/cast_auth_util.h"
#include <cert.h>
#include <cryptohi.h>
......@@ -11,13 +11,17 @@
#include <string>
#include "base/logging.h"
#include "chrome/browser/extensions/api/cast_channel/cast_channel.pb.h"
#include "chrome/browser/extensions/api/cast_channel/cast_message_util.h"
#include "crypto/nss_util.h"
#include "crypto/scoped_nss_types.h"
#include "extensions/browser/api/cast_channel/cast_channel.pb.h"
#include "extensions/browser/api/cast_channel/cast_message_util.h"
#include "net/base/hash_value.h"
#include "net/cert/x509_certificate.h"
namespace extensions {
namespace core_api {
namespace cast_channel {
namespace {
// Fingerprints and public keys of the allowed / trusted ICAs.
......@@ -183,11 +187,9 @@ static int GetICAWithFingerprint(const net::SHA1HashValue& fingerprint) {
}
// Parses out DeviceAuthMessage from CastMessage
static bool ParseAuthMessage(
const extensions::api::cast_channel::CastMessage& challenge_reply,
extensions::api::cast_channel::DeviceAuthMessage* auth_message) {
if (challenge_reply.payload_type() !=
extensions::api::cast_channel::CastMessage_PayloadType_BINARY) {
static bool ParseAuthMessage(const CastMessage& challenge_reply,
DeviceAuthMessage* auth_message) {
if (challenge_reply.payload_type() != CastMessage_PayloadType_BINARY) {
VLOG(1) << "Wrong payload type in challenge reply";
return false;
}
......@@ -214,9 +216,8 @@ static bool ParseAuthMessage(
// Authenticates the given credentials:
// 1. |signature| verification of |data| using |certificate|.
// 2. |certificate| is signed by a trusted CA.
bool VerifyCredentials(
const extensions::api::cast_channel::AuthResponse& response,
const std::string& data) {
bool VerifyCredentials(const AuthResponse& response,
const std::string& data) {
const std::string& certificate = response.client_auth_certificate();
const std::string& signature = response.signature();
......@@ -302,10 +303,6 @@ bool VerifyCredentials(
} // namespace
namespace extensions {
namespace api {
namespace cast_channel {
bool AuthenticateChallengeReply(const CastMessage& challenge_reply,
const std::string& peer_cert) {
if (peer_cert.empty())
......@@ -321,5 +318,5 @@ bool AuthenticateChallengeReply(const CastMessage& challenge_reply,
}
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_auth_util.h"
#include "extensions/browser/api/cast_channel/cast_auth_util.h"
#include "base/logging.h"
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
bool AuthenticateChallengeReply(const CastMessage& challenge_reply,
......@@ -17,5 +17,5 @@ bool AuthenticateChallengeReply(const CastMessage& challenge_reply,
}
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -6,7 +6,7 @@ syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package extensions.api.cast_channel;
package extensions.core_api.cast_channel;
message CastMessage {
// Always pass a version of the protocol for future compatibility
......@@ -27,7 +27,7 @@ message CastMessage {
//
// For messages to or from the sender or receiver platform, the special ids
// 'sender-0' and 'receiver-0' can be used.
//
//
// For messages intended for all endpoints using a given channel, the
// wildcard destination_id '*' can be used.
required string source_id = 2;
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_channel_api.h"
#include "extensions/browser/api/cast_channel/cast_channel_api.h"
#include <limits>
#include <string>
......@@ -11,10 +11,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "chrome/browser/net/chrome_net_log.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include "extensions/browser/event_router.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
......@@ -109,7 +107,7 @@ scoped_ptr<CastSocket> CastChannelAPI::CreateCastSocket(
} else {
return scoped_ptr<CastSocket>(
new CastSocket(extension_id, ip_endpoint, channel_auth, this,
g_browser_process->net_log(),
ExtensionsBrowserClient::Get()->GetNetLog(),
timeout));
}
}
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "chrome/common/extensions/api/cast_channel.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/async_api_function.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/common/api/cast_channel.h"
class GURL;
class CastChannelAPITest;
......@@ -29,7 +29,7 @@ class IPEndPoint;
namespace extensions {
namespace cast_channel = api::cast_channel;
namespace cast_channel = core_api::cast_channel;
class CastChannelAPI : public BrowserContextKeyedAPI,
public cast_channel::CastSocket::Delegate {
......@@ -205,4 +205,4 @@ class CastChannelCloseFunction : public CastChannelAsyncApiFunction {
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_channel_api.h"
#include "extensions/browser/api/cast_channel/cast_channel_api.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/ip_endpoint.h"
......@@ -10,7 +10,7 @@
#include "url/gurl.h"
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
// Tests URL parsing and validation.
......@@ -63,5 +63,5 @@ TEST(CastChannelOpenFunctionTest, TestParseConnectInfo) {
}
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "chrome/browser/extensions/api/cast_channel/cast_channel_api.h"
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/api/cast_channel.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/cast_channel/cast_channel_api.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include "extensions/common/api/cast_channel.h"
#include "extensions/common/switches.h"
#include "net/base/capturing_net_log.h"
#include "net/base/completion_callback.h"
......@@ -20,7 +20,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gmock_mutant.h"
namespace cast_channel = extensions::api::cast_channel;
namespace cast_channel = extensions::core_api::cast_channel;
using cast_channel::CastSocket;
using cast_channel::ChannelError;
using cast_channel::MessageInfo;
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_message_util.h"
#include "extensions/browser/api/cast_channel/cast_message_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/cast_channel/cast_channel.pb.h"
#include "chrome/common/extensions/api/cast_channel.h"
#include "extensions/browser/api/cast_channel/cast_channel.pb.h"
#include "extensions/common/api/cast_channel.h"
namespace {
static const char kAuthNamespace[] =
......@@ -20,7 +20,7 @@ static const char kPlatformReceiverId[] = "receiver-0";
} // namespace
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
bool MessageInfoToCastMessage(const MessageInfo& message,
......@@ -146,5 +146,5 @@ bool IsAuthMessage(const CastMessage& message) {
}
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#include <string>
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
class CastMessage;
......@@ -36,7 +36,7 @@ void CreateAuthChallengeMessage(CastMessage* message_proto);
bool IsAuthMessage(const CastMessage& message);
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_MESSAGE_UTIL_H_
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include <stdlib.h>
#include <string.h>
......@@ -13,9 +13,9 @@
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/sys_byteorder.h"
#include "chrome/browser/extensions/api/cast_channel/cast_auth_util.h"
#include "chrome/browser/extensions/api/cast_channel/cast_channel.pb.h"
#include "chrome/browser/extensions/api/cast_channel/cast_message_util.h"
#include "extensions/browser/api/cast_channel/cast_auth_util.h"
#include "extensions/browser/api/cast_channel/cast_channel.pb.h"
#include "extensions/browser/api/cast_channel/cast_message_util.h"
#include "net/base/address_list.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
......@@ -49,18 +49,18 @@ const int kTcpKeepAliveDelaySecs = 10;
namespace extensions {
static base::LazyInstance<BrowserContextKeyedAPIFactory<
ApiResourceManager<api::cast_channel::CastSocket> > > g_factory =
ApiResourceManager<core_api::cast_channel::CastSocket> > > g_factory =
LAZY_INSTANCE_INITIALIZER;
// static
template <>
BrowserContextKeyedAPIFactory<
ApiResourceManager<api::cast_channel::CastSocket> >*
ApiResourceManager<api::cast_channel::CastSocket>::GetFactoryInstance() {
ApiResourceManager<core_api::cast_channel::CastSocket> >*
ApiResourceManager<core_api::cast_channel::CastSocket>::GetFactoryInstance() {
return g_factory.Pointer();
}
namespace api {
namespace core_api {
namespace cast_channel {
CastSocket::CastSocket(const std::string& owner_extension_id,
......@@ -739,8 +739,8 @@ base::Timer* CastSocket::GetTimer() {
CastSocket::MessageHeader::MessageHeader() : message_size(0) { }
void CastSocket::MessageHeader::SetMessageSize(size_t size) {
DCHECK(size < static_cast<size_t>(kuint32max));
DCHECK(size > 0);
DCHECK_LT(size, static_cast<size_t>(kuint32max));
DCHECK_GT(size, 0U);
message_size = static_cast<size_t>(size);
}
......@@ -788,7 +788,7 @@ bool CastSocket::WriteRequest::SetContent(const CastMessage& message_proto) {
CastSocket::WriteRequest::~WriteRequest() { }
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
#undef VLOG_WITH_CONNECTION
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_SOCKET_H_
#define CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_SOCKET_H_
#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
#include <queue>
#include <string>
......@@ -16,9 +16,9 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "chrome/common/extensions/api/cast_channel.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/common/api/cast_channel.h"
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
......@@ -34,7 +34,7 @@ class TransportSecurityState;
}
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
class CastMessage;
......@@ -368,7 +368,7 @@ class CastSocket : public ApiResource,
};
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_CAST_CHANNEL_CAST_SOCKET_H_
#endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/cast_channel/cast_socket.h"
#include "extensions/browser/api/cast_channel/cast_socket.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
......@@ -10,8 +10,8 @@
#include "base/strings/string_number_conversions.h"
#include "base/sys_byteorder.h"
#include "base/timer/mock_timer.h"
#include "chrome/browser/extensions/api/cast_channel/cast_channel.pb.h"
#include "chrome/browser/extensions/api/cast_channel/cast_message_util.h"
#include "extensions/browser/api/cast_channel/cast_channel.pb.h"
#include "extensions/browser/api/cast_channel/cast_message_util.h"
#include "net/base/address_list.h"
#include "net/base/capturing_net_log.h"
#include "net/base/net_errors.h"
......@@ -41,7 +41,7 @@ const char* kTestData[4] = {
} // namespace
namespace extensions {
namespace api {
namespace core_api {
namespace cast_channel {
// Fills in |message| with a string message.
......@@ -837,7 +837,6 @@ TEST_F(CastSocketTest, TestWriteErrorLargeMessage) {
EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state());
EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state());
}
// Test write error - network error (sync)
......@@ -1060,5 +1059,5 @@ TEST_F(CastSocketTest, TestReadBodyParseError) {
}
} // namespace cast_channel
} // namespace api
} // namespace core_api
} // namespace extensions
......@@ -2,21 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/hid/hid_api.h"
#include "extensions/browser/api/hid/hid_api.h"
#include <string>
#include <vector>
#include "chrome/common/extensions/api/hid.h"
#include "device/hid/hid_connection.h"
#include "device/hid/hid_device_info.h"
#include "device/hid/hid_service.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/common/api/hid.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/permissions/usb_device_permission.h"
#include "net/base/io_buffer.h"
namespace hid = extensions::api::hid;
namespace hid = extensions::core_api::hid;
using device::HidConnection;
using device::HidDeviceInfo;
......
......@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_
#ifndef EXTENSIONS_BROWSER_API_HID_HID_API_H_
#define EXTENSIONS_BROWSER_API_HID_HID_API_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/api/hid/hid_connection_resource.h"
#include "chrome/browser/extensions/api/hid/hid_device_manager.h"
#include "chrome/common/extensions/api/hid.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/async_api_function.h"
#include "extensions/browser/api/hid/hid_connection_resource.h"
#include "extensions/browser/api/hid/hid_device_manager.h"
#include "extensions/common/api/hid.h"
namespace net {
......@@ -58,7 +58,7 @@ class HidGetDevicesFunction : public HidAsyncApiFunction {
virtual ~HidGetDevicesFunction();
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::GetDevices::Params> parameters_;
scoped_ptr<core_api::hid::GetDevices::Params> parameters_;
private:
DISALLOW_COPY_AND_ASSIGN(HidGetDevicesFunction);
......@@ -78,7 +78,7 @@ class HidConnectFunction : public HidAsyncApiFunction {
virtual ~HidConnectFunction();
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::Connect::Params> parameters_;
scoped_ptr<core_api::hid::Connect::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidConnectFunction);
};
......@@ -97,7 +97,7 @@ class HidDisconnectFunction : public HidAsyncApiFunction {
virtual ~HidDisconnectFunction();
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::Disconnect::Params> parameters_;
scoped_ptr<core_api::hid::Disconnect::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidDisconnectFunction);
};
......@@ -119,7 +119,7 @@ class HidReceiveFunction : public HidAsyncApiFunction {
scoped_refptr<net::IOBufferWithSize> buffer_;
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::Receive::Params> parameters_;
scoped_ptr<core_api::hid::Receive::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction);
};
......@@ -140,7 +140,7 @@ class HidSendFunction : public HidAsyncApiFunction {
void OnFinished(bool success, size_t bytes);
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::Send::Params> parameters_;
scoped_ptr<core_api::hid::Send::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidSendFunction);
};
......@@ -163,7 +163,7 @@ class HidReceiveFeatureReportFunction : public HidAsyncApiFunction {
scoped_refptr<net::IOBufferWithSize> buffer_;
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::ReceiveFeatureReport::Params> parameters_;
scoped_ptr<core_api::hid::ReceiveFeatureReport::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction);
};
......@@ -184,11 +184,11 @@ class HidSendFeatureReportFunction : public HidAsyncApiFunction {
void OnFinished(bool success, size_t bytes);
scoped_ptr<base::ListValue> result_;
scoped_ptr<extensions::api::hid::SendFeatureReport::Params> parameters_;
scoped_ptr<core_api::hid::SendFeatureReport::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_
#endif // EXTENSIONS_BROWSER_API_HID_HID_API_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/hid/hid_connection_resource.h"
#include "extensions/browser/api/hid/hid_connection_resource.h"
#include <string>
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_
#define CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_
#ifndef EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_
#define EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_
#include <string>
......@@ -38,4 +38,4 @@ class HidConnectionResource : public ApiResource {
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_
#endif // EXTENSIONS_BROWSER_API_HID_HID_CONNECTION_RESOURCE_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/hid/hid_device_manager.h"
#include "extensions/browser/api/hid/hid_device_manager.h"
#include <limits>
#include <vector>
......@@ -47,7 +47,7 @@ scoped_ptr<base::ListValue> HidDeviceManager::GetApiDevices(
if (hid_service->GetDeviceInfo(device_id, &device_info)) {
if (device_info.vendor_id == vendor_id &&
device_info.product_id == product_id) {
api::hid::HidDeviceInfo api_device_info;
core_api::hid::HidDeviceInfo api_device_info;
api_device_info.device_id = resource_id;
api_device_info.vendor_id = device_info.vendor_id;
api_device_info.product_id = device_info.product_id;
......@@ -69,8 +69,8 @@ scoped_ptr<base::ListValue> HidDeviceManager::GetApiDevices(
continue;
}
api::hid::HidCollectionInfo* api_collection =
new api::hid::HidCollectionInfo();
core_api::hid::HidCollectionInfo* api_collection =
new core_api::hid::HidCollectionInfo();
api_collection->usage_page = collection.usage.usage_page;
api_collection->usage = collection.usage.usage;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
#define CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
#ifndef EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
#define EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
#include <stdint.h>
......@@ -12,10 +12,9 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/hid.h"
#include "device/hid/hid_device_info.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/common/api/hid.h"
namespace extensions {
......@@ -59,4 +58,4 @@ class HidDeviceManager : public BrowserContextKeyedAPI {
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
#endif // EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
......@@ -25,6 +25,7 @@ class WebContents;
}
namespace net {
class NetLog;
class NetworkDelegate;
class URLRequest;
class URLRequestJob;
......@@ -177,6 +178,9 @@ class ExtensionsBrowserClient {
virtual ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() = 0;
// Returns the embedder's net::NetLog.
virtual net::NetLog* GetNetLog() = 0;
// Returns the single instance of |this|.
static ExtensionsBrowserClient* Get();
......
......@@ -164,4 +164,8 @@ TestExtensionsBrowserClient::GetComponentExtensionResourceManager() {
return NULL;
}
net::NetLog* TestExtensionsBrowserClient::GetNetLog() {
return NULL;
}
} // namespace extensions
......@@ -78,6 +78,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) const OVERRIDE;
virtual ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() OVERRIDE;
virtual net::NetLog* GetNetLog() OVERRIDE;
private:
content::BrowserContext* main_context_; // Not owned.
......
......@@ -9,8 +9,10 @@ generated_extensions_api("api") {
sources = [
"app_runtime.idl",
"app_view_internal.json",
"cast_channel.idl",
"dns.idl",
"extensions_manifest_types.json",
"hid.idl",
"power.idl",
"runtime.json",
"serial.idl",
......
......@@ -27,8 +27,10 @@
'schema_files': [
'app_runtime.idl',
'app_view_internal.json',
'cast_channel.idl',
'dns.idl',
'extensions_manifest_types.json',
'hid.idl',
'power.idl',
'runtime.json',
'serial.idl',
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......
......@@ -247,6 +247,7 @@
'../device/serial/serial.gyp:device_serial',
'../skia/skia.gyp:skia',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'cast_channel_proto',
'common/api/api.gyp:extensions_api',
'extensions_common',
'extensions_strings.gyp:extensions_strings',
......@@ -273,12 +274,25 @@
'browser/api/app_view/app_view_internal_api.h',
'browser/api/async_api_function.cc',
'browser/api/async_api_function.h',
'browser/api/cast_channel/cast_auth_util.h',
'browser/api/cast_channel/cast_channel_api.cc',
'browser/api/cast_channel/cast_channel_api.h',
'browser/api/cast_channel/cast_message_util.cc',
'browser/api/cast_channel/cast_message_util.h',
'browser/api/cast_channel/cast_socket.cc',
'browser/api/cast_channel/cast_socket.h',
'browser/api/dns/dns_api.cc',
'browser/api/dns/dns_api.h',
'browser/api/dns/host_resolver_wrapper.cc',
'browser/api/dns/host_resolver_wrapper.h',
'browser/api/extensions_api_client.cc',
'browser/api/extensions_api_client.h',
'browser/api/hid/hid_api.cc',
'browser/api/hid/hid_api.h',
'browser/api/hid/hid_connection_resource.cc',
'browser/api/hid/hid_connection_resource.h',
'browser/api/hid/hid_device_manager.cc',
'browser/api/hid/hid_device_manager.h',
'browser/api/power/power_api.cc',
'browser/api/power/power_api.h',
'browser/api/power/power_api_manager.cc',
......@@ -490,6 +504,27 @@
'../device/serial/serial.gyp:device_serial',
],
}],
['use_openssl==1', {
'sources': [
'browser/api/cast_channel/cast_auth_util_openssl.cc',
],
}, {
'sources': [
# cast_auth_util_nss.cc uses NSS functions.
'browser/api/cast_channel/cast_auth_util_nss.cc',
],
}],
['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
'dependencies': [
'../build/linux/system.gyp:ssl',
],
}],
['OS == "mac" or OS == "ios" or OS == "win"', {
'dependencies': [
'../third_party/nss/nss.gyp:nspr',
'../third_party/nss/nss.gyp:nss',
],
}],
],
# Disable c4267 warnings until we fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
......@@ -770,5 +805,17 @@
}],
],
},
{
# Protobuf compiler / generator for chrome.cast.channel-related protocol buffers.
# GN version: //extensions/browser/api/cast_channel/BUILD.gn
'target_name': 'cast_channel_proto',
'type': 'static_library',
'sources': [ 'browser/api/cast_channel/cast_channel.proto' ],
'variables': {
'proto_in_dir': 'browser/api/cast_channel',
'proto_out_dir': 'extensions/browser/api/cast_channel',
},
'includes': [ '../build/protoc.gypi' ]
},
]
}
......@@ -80,6 +80,7 @@
'<(DEPTH)/content/content.gyp:content_gpu',
'<(DEPTH)/content/content.gyp:content_ppapi_plugin',
'<(DEPTH)/content/content_shell_and_tests.gyp:content_shell_lib',
'<(DEPTH)/device/hid/hid.gyp:device_hid',
'<(DEPTH)/extensions/common/api/api.gyp:extensions_api',
'<(DEPTH)/extensions/extensions.gyp:extensions_browser',
'<(DEPTH)/extensions/extensions.gyp:extensions_common',
......
......@@ -239,4 +239,8 @@ ShellExtensionsBrowserClient::GetComponentExtensionResourceManager() {
return NULL;
}
net::NetLog* ShellExtensionsBrowserClient::GetNetLog() {
return NULL;
}
} // namespace extensions
......@@ -74,6 +74,7 @@ class ShellExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) const OVERRIDE;
virtual ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() OVERRIDE;
virtual net::NetLog* GetNetLog() OVERRIDE;
private:
// The single BrowserContext for app_shell. Not owned.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment