OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/feedback/feedback_profile_observer.h" | 5 #include "chrome/browser/feedback/feedback_profile_observer.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/feedback/feedback_report.h" | 9 #include "chrome/browser/feedback/feedback_report.h" |
10 #include "chrome/browser/feedback/feedback_uploader.h" | 10 #include "chrome/browser/feedback/feedback_uploader.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 void FeedbackProfileObserver::Observe( | 38 void FeedbackProfileObserver::Observe( |
39 int type, | 39 int type, |
40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
41 const content::NotificationDetails& details) { | 41 const content::NotificationDetails& details) { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
43 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); | 43 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); |
44 | 44 |
45 Profile* profile = content::Source<Profile>(source).ptr(); | 45 Profile* profile = content::Source<Profile>(source).ptr(); |
46 if (!profile->IsOffTheRecord()) | 46 if (profile && !profile->IsOffTheRecord()) |
47 QueueUnsentReports(profile); | 47 QueueUnsentReports(profile); |
48 } | 48 } |
49 | 49 |
50 void FeedbackProfileObserver::QueueUnsentReports( | 50 void FeedbackProfileObserver::QueueUnsentReports( |
51 content::BrowserContext* context) { | 51 content::BrowserContext* context) { |
52 feedback::FeedbackUploader* uploader = | 52 feedback::FeedbackUploader* uploader = |
53 feedback::FeedbackUploaderFactory::GetForBrowserContext(context); | 53 feedback::FeedbackUploaderFactory::GetForBrowserContext(context); |
54 BrowserThread::PostBlockingPoolTask(FROM_HERE, | 54 BrowserThread::PostBlockingPoolTask(FROM_HERE, |
55 base::Bind( | 55 base::Bind(&FeedbackReport::LoadReportsAndQueue, |
56 &FeedbackReport::LoadReportsAndQueue, context, base::Bind( | 56 context->GetPath(), |
57 &FeedbackUploader::QueueReport, uploader->AsWeakPtr()))); | 57 base::Bind(&FeedbackUploader::QueueReport, |
| 58 uploader->AsWeakPtr()))); |
58 } | 59 } |
59 | 60 |
60 } // namespace feedback | 61 } // namespace feedback |
OLD | NEW |