OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_omnibox_api.h" | 5 #include "chrome/browser/extensions/extension_omnibox_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 suggestion.description_styles.clear(); | 157 suggestion.description_styles.clear(); |
158 suggestion.description_styles.push_back( | 158 suggestion.description_styles.push_back( |
159 ACMatchClassification(0, ACMatchClassification::NONE)); | 159 ACMatchClassification(0, ACMatchClassification::NONE)); |
160 } | 160 } |
161 | 161 |
162 // Store the suggestion in the extension's runtime data. | 162 // Store the suggestion in the extension's runtime data. |
163 GetPropertyAccessor().SetProperty( | 163 GetPropertyAccessor().SetProperty( |
164 profile_->GetExtensionsService()->GetPropertyBag(GetExtension()), | 164 profile_->GetExtensionsService()->GetPropertyBag(GetExtension()), |
165 suggestion); | 165 suggestion); |
166 | 166 |
| 167 NotificationService::current()->Notify( |
| 168 NotificationType::EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, |
| 169 Source<Profile>(profile_), |
| 170 NotificationService::NoDetails()); |
| 171 |
167 return true; | 172 return true; |
168 } | 173 } |
169 | 174 |
170 ExtensionOmniboxSuggestion::ExtensionOmniboxSuggestion() {} | 175 ExtensionOmniboxSuggestion::ExtensionOmniboxSuggestion() {} |
171 | 176 |
172 ExtensionOmniboxSuggestion::~ExtensionOmniboxSuggestion() {} | 177 ExtensionOmniboxSuggestion::~ExtensionOmniboxSuggestion() {} |
173 | 178 |
174 bool ExtensionOmniboxSuggestion::ReadStylesFromValue( | 179 bool ExtensionOmniboxSuggestion::ReadStylesFromValue( |
175 const ListValue& styles_value) { | 180 const ListValue& styles_value) { |
176 description_styles.clear(); | 181 description_styles.clear(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 description.replace(placeholder, kPlaceholderText.length(), replacement); | 253 description.replace(placeholder, kPlaceholderText.length(), replacement); |
249 | 254 |
250 for (size_t i = 0; i < description_styles.size(); ++i) { | 255 for (size_t i = 0; i < description_styles.size(); ++i) { |
251 if (description_styles[i].offset > placeholder) | 256 if (description_styles[i].offset > placeholder) |
252 description_styles[i].offset += replacement.length() - 2; | 257 description_styles[i].offset += replacement.length() - 2; |
253 } | 258 } |
254 } | 259 } |
255 | 260 |
256 match->contents.assign(UTF16ToWide(description)); | 261 match->contents.assign(UTF16ToWide(description)); |
257 } | 262 } |
OLD | NEW |