| 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_private_api.h" | 5 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 89 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
| 90 LOG(WARNING) << "FEEDBACK_DEBUG: Dispatching onFeedbackRequested event."; | 90 LOG(WARNING) << "FEEDBACK_DEBUG: Dispatching onFeedbackRequested event."; |
| 91 EventRouter::Get(browser_context_) | 91 EventRouter::Get(browser_context_) |
| 92 ->DispatchEventToExtension(kFeedbackExtensionId, event.Pass()); | 92 ->DispatchEventToExtension(kFeedbackExtensionId, event.Pass()); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 // static | 96 // static |
| 97 base::Closure* FeedbackPrivateGetStringsFunction::test_callback_ = NULL; | 97 base::Closure* FeedbackPrivateGetStringsFunction::test_callback_ = NULL; |
| 98 | 98 |
| 99 bool FeedbackPrivateGetStringsFunction::RunImpl() { | 99 bool FeedbackPrivateGetStringsFunction::RunSync() { |
| 100 base::DictionaryValue* dict = new base::DictionaryValue(); | 100 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 101 SetResult(dict); | 101 SetResult(dict); |
| 102 | 102 |
| 103 #define SET_STRING(id, idr) \ | 103 #define SET_STRING(id, idr) \ |
| 104 dict->SetString(id, l10n_util::GetStringUTF16(idr)) | 104 dict->SetString(id, l10n_util::GetStringUTF16(idr)) |
| 105 SET_STRING("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE); | 105 SET_STRING("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE); |
| 106 SET_STRING("page-url", IDS_FEEDBACK_REPORT_URL_LABEL); | 106 SET_STRING("page-url", IDS_FEEDBACK_REPORT_URL_LABEL); |
| 107 SET_STRING("screenshot", IDS_FEEDBACK_SCREENSHOT_LABEL); | 107 SET_STRING("screenshot", IDS_FEEDBACK_SCREENSHOT_LABEL); |
| 108 SET_STRING("user-email", IDS_FEEDBACK_USER_EMAIL_LABEL); | 108 SET_STRING("user-email", IDS_FEEDBACK_USER_EMAIL_LABEL); |
| 109 #if defined(OS_CHROMEOS) | 109 #if defined(OS_CHROMEOS) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 #undef SET_STRING | 125 #undef SET_STRING |
| 126 | 126 |
| 127 webui::SetFontAndTextDirection(dict); | 127 webui::SetFontAndTextDirection(dict); |
| 128 | 128 |
| 129 if (test_callback_ && !test_callback_->is_null()) | 129 if (test_callback_ && !test_callback_->is_null()) |
| 130 test_callback_->Run(); | 130 test_callback_->Run(); |
| 131 | 131 |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool FeedbackPrivateGetUserEmailFunction::RunImpl() { | 135 bool FeedbackPrivateGetUserEmailFunction::RunSync() { |
| 136 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 136 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
| 137 LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested."; | 137 LOG(WARNING) << "FEEDBACK_DEBUG: User e-mail requested."; |
| 138 FeedbackService* service = | 138 FeedbackService* service = |
| 139 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); | 139 FeedbackPrivateAPI::GetFactoryInstance()->Get(GetProfile())->GetService(); |
| 140 DCHECK(service); | 140 DCHECK(service); |
| 141 SetResult(new base::StringValue(service->GetUserEmail())); | 141 SetResult(new base::StringValue(service->GetUserEmail())); |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool FeedbackPrivateGetSystemInformationFunction::RunImpl() { | 145 bool FeedbackPrivateGetSystemInformationFunction::RunImpl() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 void FeedbackPrivateSendFeedbackFunction::OnCompleted( | 235 void FeedbackPrivateSendFeedbackFunction::OnCompleted( |
| 236 bool success) { | 236 bool success) { |
| 237 results_ = feedback_private::SendFeedback::Results::Create( | 237 results_ = feedback_private::SendFeedback::Results::Create( |
| 238 success ? feedback_private::STATUS_SUCCESS : | 238 success ? feedback_private::STATUS_SUCCESS : |
| 239 feedback_private::STATUS_DELAYED); | 239 feedback_private::STATUS_DELAYED); |
| 240 SendResponse(true); | 240 SendResponse(true); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |