| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_profile.h" | 5 #include "chrome/browser/spellchecker/spellcheck_profile.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // If we are already loading the spellchecker, and this is just a hint to | 45 // If we are already loading the spellchecker, and this is just a hint to |
| 46 // load the spellchecker, do nothing. | 46 // load the spellchecker, do nothing. |
| 47 if (!force && host_.get()) | 47 if (!force && host_.get()) |
| 48 return REINITIALIZE_DID_NOTHING; | 48 return REINITIALIZE_DID_NOTHING; |
| 49 | 49 |
| 50 host_ready_ = false; | 50 host_ready_ = false; |
| 51 | 51 |
| 52 bool host_deleted = false; | 52 bool host_deleted = false; |
| 53 if (host_.get()) { | 53 if (host_.get()) { |
| 54 host_->UnsetProfile(); | 54 host_->UnsetProfile(); |
| 55 host_ = NULL; | 55 host_.reset(NULL); |
| 56 host_deleted = true; | 56 host_deleted = true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 if (enable) { | 59 if (enable) { |
| 60 // Retrieve the (perhaps updated recently) dictionary name from preferences. | 60 // Retrieve the (perhaps updated recently) dictionary name from preferences. |
| 61 host_ = CreateHost(this, language, request_context, metrics_.get()); | 61 host_.reset(CreateHost(this, language, request_context, metrics_.get())); |
| 62 return REINITIALIZE_CREATED_HOST; | 62 return REINITIALIZE_CREATED_HOST; |
| 63 } | 63 } |
| 64 | 64 |
| 65 return host_deleted ? REINITIALIZE_REMOVED_HOST : REINITIALIZE_DID_NOTHING; | 65 return host_deleted ? REINITIALIZE_REMOVED_HOST : REINITIALIZE_DID_NOTHING; |
| 66 } | 66 } |
| 67 | 67 |
| 68 SpellCheckHost* SpellCheckProfile::CreateHost( | 68 SpellCheckHost* SpellCheckProfile::CreateHost( |
| 69 SpellCheckProfileProvider* provider, | 69 SpellCheckProfileProvider* provider, |
| 70 const std::string& language, | 70 const std::string& language, |
| 71 net::URLRequestContextGetter* request_context, | 71 net::URLRequestContextGetter* request_context, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 const FilePath& SpellCheckProfile::GetCustomDictionaryPath() { | 142 const FilePath& SpellCheckProfile::GetCustomDictionaryPath() { |
| 143 if (!custom_dictionary_path_.get()) { | 143 if (!custom_dictionary_path_.get()) { |
| 144 custom_dictionary_path_.reset( | 144 custom_dictionary_path_.reset( |
| 145 new FilePath(profile_dir_.Append(chrome::kCustomDictionaryFileName))); | 145 new FilePath(profile_dir_.Append(chrome::kCustomDictionaryFileName))); |
| 146 } | 146 } |
| 147 | 147 |
| 148 return *custom_dictionary_path_; | 148 return *custom_dictionary_path_; |
| 149 } | 149 } |
| OLD | NEW |