| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_rlz_module.h" | 5 #include "chrome/browser/extensions/extension_rlz_module.h" |
| 6 | 6 |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "chrome/browser/rlz/rlz.h" | |
| 9 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 10 #include "rlz/win/lib/lib_values.h" | 9 #include "rlz/win/lib/lib_values.h" |
| 11 | 10 |
| 12 namespace { | 11 namespace { |
| 13 | 12 |
| 14 bool GetProductFromName(const std::string& product_name, | 13 bool GetProductFromName(const std::string& product_name, |
| 15 rlz_lib::Product* product) { | 14 rlz_lib::Product* product) { |
| 16 bool success = true; | 15 bool success = true; |
| 17 switch (product_name[0]) { | 16 switch (product_name[0]) { |
| 18 case 'B': | 17 case 'B': |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &ap_name)); | 78 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &ap_name)); |
| 80 rlz_lib::AccessPoint access_point; | 79 rlz_lib::AccessPoint access_point; |
| 81 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName(ap_name.c_str(), | 80 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName(ap_name.c_str(), |
| 82 &access_point)); | 81 &access_point)); |
| 83 | 82 |
| 84 std::string event_name; | 83 std::string event_name; |
| 85 EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &event_name)); | 84 EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &event_name)); |
| 86 rlz_lib::Event event_id; | 85 rlz_lib::Event event_id; |
| 87 EXTENSION_FUNCTION_VALIDATE(GetEventFromName(event_name, &event_id)); | 86 EXTENSION_FUNCTION_VALIDATE(GetEventFromName(event_name, &event_id)); |
| 88 | 87 |
| 89 return RLZTracker::RecordProductEvent(product, access_point, event_id); | 88 return rlz_lib::RecordProductEvent(product, access_point, event_id); |
| 90 } | 89 } |
| 91 | 90 |
| 92 bool RlzGetAccessPointRlzFunction::RunImpl() { | 91 bool RlzGetAccessPointRlzFunction::RunImpl() { |
| 93 std::string ap_name; | 92 std::string ap_name; |
| 94 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &ap_name)); | 93 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &ap_name)); |
| 95 rlz_lib::AccessPoint access_point; | 94 rlz_lib::AccessPoint access_point; |
| 96 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName(ap_name.c_str(), | 95 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName(ap_name.c_str(), |
| 97 &access_point)); | 96 &access_point)); |
| 98 | 97 |
| 99 char rlz[rlz_lib::kMaxRlzLength + 1]; | 98 char rlz[rlz_lib::kMaxRlzLength + 1]; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 std::string ap_name; | 172 std::string ap_name; |
| 174 EXTENSION_FUNCTION_VALIDATE(access_points_list->GetString(i, &ap_name)); | 173 EXTENSION_FUNCTION_VALIDATE(access_points_list->GetString(i, &ap_name)); |
| 175 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName( | 174 EXTENSION_FUNCTION_VALIDATE(rlz_lib::GetAccessPointFromName( |
| 176 ap_name.c_str(), &access_points[i])); | 175 ap_name.c_str(), &access_points[i])); |
| 177 } | 176 } |
| 178 access_points[i] = rlz_lib::NO_ACCESS_POINT; | 177 access_points[i] = rlz_lib::NO_ACCESS_POINT; |
| 179 | 178 |
| 180 rlz_lib::ClearProductState(product, access_points.get()); | 179 rlz_lib::ClearProductState(product, access_points.get()); |
| 181 return true; | 180 return true; |
| 182 } | 181 } |
| OLD | NEW |