diff options
author | xiaohuic <xiaohuic@chromium.org> | 2015-02-17 10:04:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-17 18:05:33 +0000 |
commit | 4b5aef62bbbf566031efd57921bf2a5ef5498cef (patch) | |
tree | 8bdb0effb1be41a38c808da3cb9b59487fd27c0e | |
parent | 2ce480a20c0487af08240bd03865f824d38edd2c (diff) | |
download | chromium_src-4b5aef62bbbf566031efd57921bf2a5ef5498cef.zip chromium_src-4b5aef62bbbf566031efd57921bf2a5ef5498cef.tar.gz chromium_src-4b5aef62bbbf566031efd57921bf2a5ef5498cef.tar.bz2 |
Refactor debug_daemon_client.h to use debugd::DevFeatureFlag
debug_daemon_client.h used to define its own duplicate enum. This cl
unifies it to use the enum defined in debugd.
BUG=444146
TEST=locally on chromebook.
Review URL: https://codereview.chromium.org/925903006
Cr-Commit-Position: refs/heads/master@{#316607}
5 files changed, 23 insertions, 29 deletions
diff --git a/chrome/browser/chromeos/login/enable_debugging_browsertest.cc b/chrome/browser/chromeos/login/enable_debugging_browsertest.cc index 74de9b6..fc9e571 100644 --- a/chrome/browser/chromeos/login/enable_debugging_browsertest.cc +++ b/chrome/browser/chromeos/login/enable_debugging_browsertest.cc @@ -26,6 +26,7 @@ #include "chromeos/dbus/fake_update_engine_client.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" +#include "third_party/cros_system_api/dbus/service_constants.h" namespace chromeos { @@ -247,7 +248,7 @@ class EnableDebuggingTest : public LoginManagerTest { void ShowSetupScreen() { debug_daemon_client_->SetDebuggingFeaturesStatus( - DebugDaemonClient::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); + debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); WaitUntilJSIsReady(); JSExpect("!!document.querySelector('#debugging.hidden')"); InvokeEnableDebuggingScreen(); @@ -307,8 +308,8 @@ IN_PROC_BROWSER_TEST_F(EnableDebuggingTest, ShowSetup) { // Invoking debug screen should show remove protection screen. IN_PROC_BROWSER_TEST_F(EnableDebuggingTest, ShowOnTestImages) { debug_daemon_client_->SetDebuggingFeaturesStatus( - DebugDaemonClient::DEV_FEATURE_SSH_SERVER_CONFIGURED | - DebugDaemonClient::DEV_FEATURE_SYSTEM_ROOT_PASSWORD_SET); + debugd::DevFeatureFlag::DEV_FEATURE_SSH_SERVER_CONFIGURED | + debugd::DevFeatureFlag::DEV_FEATURE_SYSTEM_ROOT_PASSWORD_SET); WaitUntilJSIsReady(); JSExpect("!!document.querySelector('#debugging.hidden')"); InvokeEnableDebuggingScreen(); @@ -398,7 +399,7 @@ class EnableDebuggingRequestedTest : public EnableDebuggingTest { EnableDebuggingTest::SetUpInProcessBrowserTestFixture(); debug_daemon_client_->SetDebuggingFeaturesStatus( - DebugDaemonClient::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); + debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED); } }; diff --git a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc index 341f71a..4f9ffd9 100644 --- a/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler.cc @@ -244,13 +244,14 @@ void EnableDebuggingScreenHandler::OnQueryDebuggingFeatures(bool success, DVLOG(1) << "Enable-debugging-screen: OnQueryDebuggingFeatures" << ", success=" << success << ", features=" << features_flag; - if (!success || features_flag == DebugDaemonClient::DEV_FEATURES_DISABLED) { + if (!success || + features_flag == debugd::DevFeatureFlag::DEV_FEATURES_DISABLED) { UpdateUIState(UI_STATE_ERROR); return; } if ((features_flag & - DebugDaemonClient::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED) == 0) { + debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED) == 0) { UpdateUIState(UI_STATE_REMOVE_PROTECTION); return; } diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc index 3e72384..f078090 100644 --- a/chromeos/dbus/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon_client.cc @@ -517,7 +517,7 @@ class DebugDaemonClientImpl : public DebugDaemonClient { int32 feature_mask = DEV_FEATURE_NONE; if (!response || !dbus::MessageReader(response).PopInt32(&feature_mask)) { - callback.Run(false, DEV_FEATURES_DISABLED); + callback.Run(false, debugd::DevFeatureFlag::DEV_FEATURES_DISABLED); return; } diff --git a/chromeos/dbus/debug_daemon_client.h b/chromeos/dbus/debug_daemon_client.h index 37cda58..85b1ccd 100644 --- a/chromeos/dbus/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon_client.h @@ -5,14 +5,15 @@ #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ +#include <map> + #include "base/callback.h" #include "base/files/file.h" #include "base/memory/ref_counted_memory.h" #include "base/task_runner.h" #include "chromeos/chromeos_export.h" #include "chromeos/dbus/dbus_client.h" - -#include <map> +#include "third_party/cros_system_api/dbus/service_constants.h" namespace metrics { class PerfDataProto; @@ -155,21 +156,12 @@ class CHROMEOS_EXPORT DebugDaemonClient : public DBusClient { const std::string& password, const EnableDebuggingCallback& callback) = 0; - enum DebuggingFeature { - DEV_FEATURE_NONE = 0, - DEV_FEATURES_DISABLED = 1 << 0, - DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED = 1 << 1, - DEV_FEATURE_BOOT_FROM_USB_ENABLED = 1 << 2, - DEV_FEATURE_SSH_SERVER_CONFIGURED = 1 << 3, - DEV_FEATURE_DEV_MODE_ROOT_PASSWORD_SET = 1 << 4, - DEV_FEATURE_SYSTEM_ROOT_PASSWORD_SET = 1 << 5, - DEV_FEATURE_ALL_ENABLED = - DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED | - DEV_FEATURE_BOOT_FROM_USB_ENABLED | - DEV_FEATURE_SSH_SERVER_CONFIGURED | - DEV_FEATURE_DEV_MODE_ROOT_PASSWORD_SET | - DEV_FEATURE_DEV_MODE_ROOT_PASSWORD_SET, - }; + static const int DEV_FEATURE_NONE = 0; + static const int DEV_FEATURE_ALL_ENABLED = + debugd::DevFeatureFlag::DEV_FEATURE_ROOTFS_VERIFICATION_REMOVED | + debugd::DevFeatureFlag::DEV_FEATURE_BOOT_FROM_USB_ENABLED | + debugd::DevFeatureFlag::DEV_FEATURE_SSH_SERVER_CONFIGURED | + debugd::DevFeatureFlag::DEV_FEATURE_DEV_MODE_ROOT_PASSWORD_SET; // Called once QueryDebuggingFeatures() is complete. |succeeded| will be true // if debugging features have been successfully enabled. |feature_mask| is a diff --git a/chromeos/dbus/fake_debug_daemon_client.cc b/chromeos/dbus/fake_debug_daemon_client.cc index 33888bb..0dde3ab 100644 --- a/chromeos/dbus/fake_debug_daemon_client.cc +++ b/chromeos/dbus/fake_debug_daemon_client.cc @@ -138,11 +138,11 @@ void FakeDebugDaemonClient::QueryDebuggingFeatures( chromeos::switches::kSystemDevMode); base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(callback, - true, - static_cast<int>( - supported ? featues_mask_ : - DebugDaemonClient::DEV_FEATURES_DISABLED))); + base::Bind( + callback, true, + static_cast<int>( + supported ? featues_mask_ + : debugd::DevFeatureFlag::DEV_FEATURES_DISABLED))); } void FakeDebugDaemonClient::RemoveRootfsVerification( |