Skip to content

Commit

Permalink
[CrOS MultiDevice] Move ProximityAuth logging to MultiDevice.
Browse files Browse the repository at this point in the history
The MultiDevice component is the correct location for shared
multi-device code.

Bug: 912743
Change-Id: Ie66b135d889c89edad8371ef5ed3a4facec6fd6b
Reviewed-on: https://chromium-review.googlesource.com/c/1380555
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Ben Wells <benwells@chromium.org>
Reviewed-by: Ryan Hansberry <hansberry@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#617328}
  • Loading branch information
Kyle Horimoto authored and Commit Bot committed Dec 18, 2018
1 parent cb48f7c commit 9540aca
Show file tree
Hide file tree
Showing 149 changed files with 209 additions and 189 deletions.
2 changes: 1 addition & 1 deletion ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ component("ash") {
"//chromeos",
"//chromeos:power_manager_proto",
"//chromeos/assistant:buildflags",
"//chromeos/components/proximity_auth/logging",
"//chromeos/components/multidevice/logging",
"//chromeos/services/assistant/public:feature_flags",
"//chromeos/services/assistant/public/mojom",
"//chromeos/services/multidevice_setup/public/mojom",
Expand Down
2 changes: 1 addition & 1 deletion ash/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ include_rules = [
"+chromeos/chromeos_features.h",
"+chromeos/chromeos_switches.h",
"+chromeos/chromeos_paths.h",
"+chromeos/components/proximity_auth/logging/logging.h",
"+chromeos/components/multidevice/logging/logging.h",
"+chromeos/dbus/dbus_thread_manager.h",
"+chromeos/dbus/fake_power_manager_client.h",
"+chromeos/dbus/fake_session_manager_client.h",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/services/multidevice_setup/public/mojom/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/apps/platform_apps/api/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ source_set("api") {

deps += [
"//chrome:strings",
"//chromeos/components/multidevice/logging",
"//chromeos/components/proximity_auth",
"//chromeos/components/proximity_auth/logging",
"//components/account_id",
"//components/strings:components_strings_grit",
"//components/user_manager",
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ source_set("chromeos") {
"//chromeos/components/drivefs",
"//chromeos/components/drivefs/mojom",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/logging",
"//chromeos/components/proximity_auth",
"//chromeos/components/proximity_auth/logging",
"//chromeos/components/tether",
"//chromeos/network",
"//chromeos/services/device_sync",
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/android_sms/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static_library("android_sms") {
"//base",
"//chrome/browser/chromeos:chromeos",
"//chromeos:chromeos",
"//chromeos/components/proximity_auth/logging",
"//chromeos/components/multidevice/logging",
"//chromeos/services/multidevice_setup/public/cpp:cpp",
"//chromeos/services/multidevice_setup/public/cpp:prefs",
"//components/keyed_service/content:content",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "chrome/browser/chromeos/android_sms/android_sms_urls.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/blink/public/common/messaging/string_message_codec.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/android_sms/connection_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "chrome/browser/chromeos/android_sms/connection_manager.h"
#include "chrome/browser/chromeos/android_sms/android_sms_urls.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "components/session_manager/core/session_manager.h"

namespace chromeos {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/common/pref_names.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/multidevice/secure_message_delegate_impl.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/services/device_sync/cryptauth_client.h"
#include "chromeos/services/device_sync/cryptauth_client_impl.h"
#include "chromeos/services/device_sync/cryptauth_device_manager_impl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chromeos/chromeos_features.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/services/device_sync/cryptauth_client_impl.h"
#include "chromeos/services/device_sync/cryptauth_device_manager.h"
#include "chromeos/services/device_sync/cryptauth_enrollment_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "base/bind.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/services/device_sync/proto/securemessage.pb.h"

namespace chromeos {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "base/strings/string_util.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/cryptohome/cryptohome_util.h"
#include "chromeos/cryptohome/homedir_methods.h"
#include "chromeos/cryptohome/system_salt_getter.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/cryptohome/cryptohome_util.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_names.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_factory.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "components/account_id/account_id.h"

namespace chromeos {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/proximity_auth/proximity_auth_local_state_pref_manager.h"
#include "chromeos/components/proximity_auth/proximity_auth_profile_pref_manager.h"
#include "chromeos/components/proximity_auth/proximity_auth_system.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_features.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/proximity_auth/proximity_auth_pref_names.h"
#include "chromeos/components/proximity_auth/proximity_auth_profile_pref_manager.h"
#include "chromeos/components/proximity_auth/proximity_auth_system.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_features.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/multidevice/remote_device.h"
#include "chromeos/components/multidevice/remote_device_cache.h"
#include "chromeos/components/multidevice/remote_device_ref.h"
#include "chromeos/components/multidevice/software_feature_state.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/proximity_auth/proximity_auth_local_state_pref_manager.h"
#include "chromeos/components/proximity_auth/smart_lock_metrics_recorder.h"
#include "chromeos/components/proximity_auth/switches.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "chrome/browser/web_applications/components/pending_app_manager.h"
#include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/browser/storage_partition.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/chromeos/android_sms/android_sms_urls.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "net/cookies/canonical_cookie.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/tether/tether_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_features.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h"
#include "chromeos/components/tether/tether_component.h"
#include "chromeos/components/tether/tether_component_impl.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,8 @@ jumbo_split_static_library("ui") {
"//chrome/browser/chromeos/android_sms:android_sms_urls",
"//chromeos:cryptohome_proto",
"//chromeos/components/multidevice",
"//chromeos/components/multidevice/logging",
"//chromeos/components/proximity_auth",
"//chromeos/components/proximity_auth/logging",
"//chromeos/components/proximity_auth/webui",
"//chromeos/components/tether",
"//chromeos/resources:resources_grit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/network/network_connect.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_palette.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "chrome/browser/chromeos/multidevice_setup/android_sms_app_helper_delegate_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/proximity_auth/proximity_auth_pref_names.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
Expand Down
3 changes: 2 additions & 1 deletion chromeos/components/multidevice/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static_library("multidevice") {
"//base",
"//base:i18n",
"//chromeos",
"//chromeos/components/proximity_auth/logging",
"//chromeos/components/multidevice/logging",
"//chromeos/services/device_sync/proto",
"//chromeos/services/device_sync/proto:util",
"//components/prefs",
Expand Down Expand Up @@ -71,6 +71,7 @@ source_set("unit_tests") {
":multidevice",
":test_support",
"//base/test:test_support",
"//chromeos/components/multidevice/logging:unit_tests",
"//chromeos/components/multidevice/mojom:unit_tests",
"//chromeos/services/device_sync/proto",
"//testing/gtest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromeos/components/proximity_auth/logging/log_buffer.h"
#include "chromeos/components/multidevice/logging/log_buffer.h"

#include "base/lazy_instance.h"

namespace proximity_auth {
namespace chromeos {

namespace multidevice {

namespace {

Expand Down Expand Up @@ -62,4 +64,6 @@ size_t LogBuffer::MaxBufferSize() const {
return kMaxBufferSize;
}

} // namespace proximity_auth
} // namespace multidevice

} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -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 CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOG_BUFFER_H_
#define CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOG_BUFFER_H_
#ifndef CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOG_BUFFER_H_
#define CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOG_BUFFER_H_

#include <stddef.h>

Expand All @@ -14,7 +14,9 @@
#include "base/observer_list.h"
#include "base/time/time.h"

namespace proximity_auth {
namespace chromeos {

namespace multidevice {

// Contains logs specific to the Proximity Auth. This buffer has a maximum size
// and will discard entries in FIFO order.
Expand Down Expand Up @@ -78,6 +80,8 @@ class LogBuffer {
DISALLOW_COPY_AND_ASSIGN(LogBuffer);
};

} // namespace proximity_auth
} // namespace multidevice

} // namespace chromeos

#endif // CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOG_BUFFER_H_
#endif // CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOG_BUFFER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"

#include "chromeos/components/proximity_auth/logging/log_buffer.h"
#include "chromeos/components/multidevice/logging/log_buffer.h"

namespace chromeos {

namespace multidevice {

namespace proximity_auth {
namespace {

bool g_logging_enabled = true;
Expand Down Expand Up @@ -47,4 +50,6 @@ ScopedLogMessage::~ScopedLogMessage() {
log_message.stream() << string_from_stream;
}

} // namespace proximity_auth
} // namespace multidevice

} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOGGING_H_
#define CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOGGING_H_
#ifndef CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOGGING_H_
#define CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOGGING_H_

#include <sstream>

#include "base/logging.h"
#include "base/macros.h"

namespace proximity_auth {
namespace chromeos {

namespace multidevice {

// Use the PA_LOG() macro for all logging related to Proximity Auth, so the
// system is aware of all logs related to this feature. We display these logs in
Expand All @@ -21,9 +23,9 @@ namespace proximity_auth {
// Examples:
// PA_LOG(INFO) << "Waiting for " << x << " pending requests.";
// PA_LOG(ERROR) << "Request failed: " << error_string;
#define PA_LOG(severity) \
proximity_auth::ScopedLogMessage(__FILE__, __LINE__, \
logging::LOG_##severity) \
#define PA_LOG(severity) \
chromeos::multidevice::ScopedLogMessage(__FILE__, __LINE__, \
logging::LOG_##severity) \
.stream()

// Disables all logging while in scope. Intended to be called only from test
Expand Down Expand Up @@ -55,6 +57,8 @@ class ScopedLogMessage {
DISALLOW_COPY_AND_ASSIGN(ScopedLogMessage);
};

} // namespace proximity_auth
} // namespace multidevice

} // namespace chromeos

#endif // CHROMEOS_COMPONENTS_PROXIMITY_AUTH_LOGGING_LOGGING_H_
#endif // CHROMEOS_COMPONENTS_MULTIDEVICE_LOGGING_LOGGING_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"

#include <stddef.h>

#include "base/lazy_instance.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "chromeos/components/proximity_auth/logging/log_buffer.h"
#include "chromeos/components/multidevice/logging/log_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace proximity_auth {
namespace chromeos {

namespace multidevice {

namespace {

Expand Down Expand Up @@ -126,4 +128,6 @@ TEST_F(ProximityAuthLoggingTest, StandardLogsCreated) {
EXPECT_NE(std::string::npos, g_standard_logs.Get()[2].find(kLog3));
}

} // namespace proximity_auth
} // namespace multidevice

} // namespace chromeos
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/no_destructor.h"
#include "chromeos/components/proximity_auth/logging/logging.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/easy_unlock_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
Expand Down
Loading

0 comments on commit 9540aca

Please sign in to comment.