Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1900)

Unified Diff: chrome/browser/chromeos/extensions/echo_private_api.cc

Issue 10086011: [Chrome OS ECHO]: Rename API and method names (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/echo_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fa8dac7114646b5a4295998b2ff5d51bdffd03ff
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/echo_private_api.cc
@@ -0,0 +1,70 @@
+// Copyright (c) 2012 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/chromeos/extensions/echo_private_api.h"
+
+#include <string>
+
+#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/browser/chromeos/system/statistics_provider.h"
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
+#include "chrome/browser/extensions/extension_tab_util.h"
+#include "chrome/browser/extensions/extension_window_controller.h"
+#include "chrome/browser/infobars/infobar_tab_helper.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/extensions/extension.h"
+#include "content/public/browser/notification_details.h"
tbarzic 2012/04/17 18:23:04 includes could use some cleanup :)
gauravsh 2012/04/17 19:05:52 Done.
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/web_contents.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace {
+
+// For a given registration code type, returns the code value from the
+// underlying system.
+std::string GetValueForRegistrationCodeType(std::string& type) {
+ // Possible ECHO code type and corresponding key name in StatisticsProvider.
+ const std::string kCouponType = "COUPON_CODE";
+ const std::string kCouponCodeKey = "ubind_attribute";
+ const std::string kGroupType = "GROUP_CODE";
+ const std::string kGroupCodeKey = "gbind_attribute";
+
+ chromeos::system::StatisticsProvider* provider =
+ chromeos::system::StatisticsProvider::GetInstance();
+ std::string result;
+ if (type == kCouponType)
+ provider->GetMachineStatistic(kCouponCodeKey, &result);
+ else if (type == kGroupType)
+ provider->GetMachineStatistic(kGroupCodeKey, &result);
+ return result;
+}
+
+} // namespace
+
+
+GetRegistrationCodeFunction::GetRegistrationCodeFunction() {
+}
+
+GetRegistrationCodeFunction::~GetRegistrationCodeFunction() {
+}
+
+bool GetRegistrationCodeFunction::RunImpl() {
+ std::string type;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &type));
+ result_.reset(Value::CreateStringValue(
+ GetValueForRegistrationCodeType(type)));
tbarzic 2012/04/17 18:23:04 This would probably look nicer if GetValueForRegis
gauravsh 2012/04/17 19:05:52 Done.
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698