| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/feedback_private/feedback_service.h" | 5 #include "chrome/browser/extensions/api/feedback_private/feedback_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
| 11 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher.h" | 11 #include "chrome/browser/chromeos/system_logs/about_system_logs_fetcher.h" |
| 12 | 12 |
| 13 using extensions::api::feedback_private::SystemInformation; | 13 using extensions::api::feedback_private::SystemInformation; |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 class FeedbackServiceImpl | 17 class FeedbackServiceImpl |
| 18 : public FeedbackService, | 18 : public FeedbackService, |
| 19 public base::SupportsWeakPtr<FeedbackServiceImpl> { | 19 public base::SupportsWeakPtr<FeedbackServiceImpl> { |
| 20 public: | 20 public: |
| 21 FeedbackServiceImpl(); | 21 FeedbackServiceImpl(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 48 chromeos::UserManager* manager = chromeos::UserManager::Get(); | 48 chromeos::UserManager* manager = chromeos::UserManager::Get(); |
| 49 if (!manager) | 49 if (!manager) |
| 50 return std::string(); | 50 return std::string(); |
| 51 else | 51 else |
| 52 return manager->GetLoggedInUser()->display_email();} | 52 return manager->GetLoggedInUser()->display_email();} |
| 53 | 53 |
| 54 void FeedbackServiceImpl::GetSystemInformation( | 54 void FeedbackServiceImpl::GetSystemInformation( |
| 55 const GetSystemInformationCallback& callback) { | 55 const GetSystemInformationCallback& callback) { |
| 56 system_information_callback_ = callback; | 56 system_information_callback_ = callback; |
| 57 | 57 |
| 58 chromeos::SystemLogsFetcher* fetcher = new chromeos::SystemLogsFetcher(); | 58 chromeos::AboutSystemLogsFetcher* fetcher = |
| 59 new chromeos::AboutSystemLogsFetcher(); |
| 59 fetcher->Fetch(base::Bind(&FeedbackServiceImpl::ProcessSystemLogs, | 60 fetcher->Fetch(base::Bind(&FeedbackServiceImpl::ProcessSystemLogs, |
| 60 AsWeakPtr())); | 61 AsWeakPtr())); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void FeedbackServiceImpl::ProcessSystemLogs( | 64 void FeedbackServiceImpl::ProcessSystemLogs( |
| 64 scoped_ptr<chromeos::SystemLogsResponse> sys_info_map) { | 65 scoped_ptr<chromeos::SystemLogsResponse> sys_info_map) { |
| 65 SystemInformationList sys_info_list; | 66 SystemInformationList sys_info_list; |
| 66 if (!sys_info_map.get()) { | 67 if (!sys_info_map.get()) { |
| 67 system_information_callback_.Run(sys_info_list); | 68 system_information_callback_.Run(sys_info_list); |
| 68 return; | 69 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 } | 82 } |
| 82 | 83 |
| 83 system_information_callback_.Run(sys_info_list); | 84 system_information_callback_.Run(sys_info_list); |
| 84 } | 85 } |
| 85 | 86 |
| 86 base::WeakPtr<FeedbackService> FeedbackServiceImpl::GetWeakPtr() { | 87 base::WeakPtr<FeedbackService> FeedbackServiceImpl::GetWeakPtr() { |
| 87 return AsWeakPtr(); | 88 return AsWeakPtr(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 } // namespace extensions | 91 } // namespace extensions |
| OLD | NEW |