| 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/spellchecker/spellcheck_custom_dictionary.h" | 5 #include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 |
| 8 #include <functional> | 9 #include <functional> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/files/important_file_writer.h" | 13 #include "base/files/important_file_writer.h" |
| 13 #include "base/md5.h" | 14 #include "base/md5.h" |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 18 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
| 18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/spellcheck_common.h" | 20 #include "chrome/common/spellcheck_common.h" |
| 21 #include "components/sync/api/sync_change.h" |
| 22 #include "components/sync/api/sync_error_factory.h" |
| 23 #include "components/sync/protocol/sync.pb.h" |
| 20 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 21 #include "sync/api/sync_change.h" | |
| 22 #include "sync/api/sync_error_factory.h" | |
| 23 #include "sync/protocol/sync.pb.h" | |
| 24 | 25 |
| 25 using content::BrowserThread; | 26 using content::BrowserThread; |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 // Filename extension for backup dictionary file. | 30 // Filename extension for backup dictionary file. |
| 30 const base::FilePath::CharType BACKUP_EXTENSION[] = FILE_PATH_LITERAL("backup"); | 31 const base::FilePath::CharType BACKUP_EXTENSION[] = FILE_PATH_LITERAL("backup"); |
| 31 | 32 |
| 32 // Prefix for the checksum in the dictionary file. | 33 // Prefix for the checksum in the dictionary file. |
| 33 const char CHECKSUM_PREFIX[] = "checksum_v1 = "; | 34 const char CHECKSUM_PREFIX[] = "checksum_v1 = "; |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 522 } |
| 522 | 523 |
| 523 void SpellcheckCustomDictionary::Notify(const Change& dictionary_change) { | 524 void SpellcheckCustomDictionary::Notify(const Change& dictionary_change) { |
| 524 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 525 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 525 if (!IsLoaded() || dictionary_change.empty()) | 526 if (!IsLoaded() || dictionary_change.empty()) |
| 526 return; | 527 return; |
| 527 FOR_EACH_OBSERVER(Observer, | 528 FOR_EACH_OBSERVER(Observer, |
| 528 observers_, | 529 observers_, |
| 529 OnCustomDictionaryChanged(dictionary_change)); | 530 OnCustomDictionaryChanged(dictionary_change)); |
| 530 } | 531 } |
| OLD | NEW |