| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/glue/typed_url_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 NOTREACHED(); | 111 NOTREACHED(); |
| 112 break; | 112 break; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool TypedUrlDataTypeController::PostTaskOnBackendThread( | 116 bool TypedUrlDataTypeController::PostTaskOnBackendThread( |
| 117 const tracked_objects::Location& from_here, | 117 const tracked_objects::Location& from_here, |
| 118 const base::Closure& task) { | 118 const base::Closure& task) { |
| 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 120 HistoryService* history = HistoryServiceFactory::GetForProfile( | 120 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 121 profile(), Profile::IMPLICIT_ACCESS); | 121 profile(), Profile::IMPLICIT_ACCESS).get(); |
| 122 if (history) { | 122 if (history) { |
| 123 history->ScheduleDBTask(new RunTaskOnHistoryThread(task, this), | 123 history->ScheduleDBTask(new RunTaskOnHistoryThread(task, this), |
| 124 &cancelable_consumer_); | 124 &cancelable_consumer_); |
| 125 return true; | 125 return true; |
| 126 } else { | 126 } else { |
| 127 // History must be disabled - don't start. | 127 // History must be disabled - don't start. |
| 128 LOG(WARNING) << "Cannot access history service - disabling typed url sync"; | 128 LOG(WARNING) << "Cannot access history service - disabling typed url sync"; |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 } | 131 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 void TypedUrlDataTypeController::StopModels() { | 146 void TypedUrlDataTypeController::StopModels() { |
| 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 148 DCHECK(state() == STOPPING || state() == NOT_RUNNING || state() == DISABLED); | 148 DCHECK(state() == STOPPING || state() == NOT_RUNNING || state() == DISABLED); |
| 149 DVLOG(1) << "TypedUrlDataTypeController::StopModels(): State = " << state(); | 149 DVLOG(1) << "TypedUrlDataTypeController::StopModels(): State = " << state(); |
| 150 notification_registrar_.RemoveAll(); | 150 notification_registrar_.RemoveAll(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TypedUrlDataTypeController::~TypedUrlDataTypeController() {} | 153 TypedUrlDataTypeController::~TypedUrlDataTypeController() {} |
| 154 | 154 |
| 155 } // namespace browser_sync | 155 } // namespace browser_sync |
| OLD | NEW |