| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // The manager is only available if tracing is enabled. | 79 // The manager is only available if tracing is enabled. |
| 80 if (TracingManager* manager = TracingManager::Get()) { | 80 if (TracingManager* manager = TracingManager::Get()) { |
| 81 info.trace_id.reset(new int(manager->RequestTrace())); | 81 info.trace_id.reset(new int(manager->RequestTrace())); |
| 82 } | 82 } |
| 83 | 83 |
| 84 scoped_ptr<base::ListValue> args(new base::ListValue()); | 84 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 85 args->Append(info.ToValue().release()); | 85 args->Append(info.ToValue().release()); |
| 86 | 86 |
| 87 scoped_ptr<Event> event(new Event( | 87 scoped_ptr<Event> event(new Event( |
| 88 feedback_private::OnFeedbackRequested::kEventName, args.Pass())); | 88 feedback_private::OnFeedbackRequested::kEventName, args.Pass())); |
| 89 event->restrict_to_browser_context = profile_; |
| 90 |
| 89 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 91 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
| 90 LOG(WARNING) << "FEEDBACK_DEBUG: Dispatching onFeedbackRequested event."; | 92 LOG(WARNING) << "FEEDBACK_DEBUG: Dispatching onFeedbackRequested event."; |
| 91 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( | 93 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( |
| 92 kFeedbackExtensionId, | 94 kFeedbackExtensionId, |
| 93 event.Pass()); | 95 event.Pass()); |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 | 98 |
| 97 // static | 99 // static |
| 98 base::Closure* FeedbackPrivateGetStringsFunction::test_callback_ = NULL; | 100 base::Closure* FeedbackPrivateGetStringsFunction::test_callback_ = NULL; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 240 |
| 239 void FeedbackPrivateSendFeedbackFunction::OnCompleted( | 241 void FeedbackPrivateSendFeedbackFunction::OnCompleted( |
| 240 bool success) { | 242 bool success) { |
| 241 results_ = feedback_private::SendFeedback::Results::Create( | 243 results_ = feedback_private::SendFeedback::Results::Create( |
| 242 success ? feedback_private::STATUS_SUCCESS : | 244 success ? feedback_private::STATUS_SUCCESS : |
| 243 feedback_private::STATUS_DELAYED); | 245 feedback_private::STATUS_DELAYED); |
| 244 SendResponse(true); | 246 SendResponse(true); |
| 245 } | 247 } |
| 246 | 248 |
| 247 } // namespace extensions | 249 } // namespace extensions |
| OLD | NEW |