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/extensions/api/omnibox/omnibox_api.h" | 5 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool ExtensionOmniboxEventRouter::OnInputChanged( | 117 bool ExtensionOmniboxEventRouter::OnInputChanged( |
118 Profile* profile, const std::string& extension_id, | 118 Profile* profile, const std::string& extension_id, |
119 const std::string& input, int suggest_id) { | 119 const std::string& input, int suggest_id) { |
120 EventRouter* event_router = EventRouter::Get(profile); | 120 EventRouter* event_router = EventRouter::Get(profile); |
121 if (!event_router->ExtensionHasEventListener( | 121 if (!event_router->ExtensionHasEventListener( |
122 extension_id, omnibox::OnInputChanged::kEventName)) | 122 extension_id, omnibox::OnInputChanged::kEventName)) |
123 return false; | 123 return false; |
124 | 124 |
125 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 125 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
126 args->Set(0, new base::StringValue(input)); | 126 args->Set(0, new base::StringValue(input)); |
127 args->Set(1, new base::FundamentalValue(suggest_id)); | 127 args->Set(1, new base::Value(suggest_id)); |
128 | 128 |
129 std::unique_ptr<Event> event = base::MakeUnique<Event>( | 129 std::unique_ptr<Event> event = base::MakeUnique<Event>( |
130 events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName, | 130 events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName, |
131 std::move(args)); | 131 std::move(args)); |
132 event->restrict_to_browser_context = profile; | 132 event->restrict_to_browser_context = profile; |
133 event_router->DispatchEventToExtension(extension_id, std::move(event)); | 133 event_router->DispatchEventToExtension(extension_id, std::move(event)); |
134 return true; | 134 return true; |
135 } | 135 } |
136 | 136 |
137 // static | 137 // static |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 for (size_t i = 0; i < description_styles.size(); ++i) { | 395 for (size_t i = 0; i < description_styles.size(); ++i) { |
396 if (description_styles[i].offset > placeholder) | 396 if (description_styles[i].offset > placeholder) |
397 description_styles[i].offset += replacement.length() - 2; | 397 description_styles[i].offset += replacement.length() - 2; |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 match->contents.assign(description); | 401 match->contents.assign(description); |
402 } | 402 } |
403 | 403 |
404 } // namespace extensions | 404 } // namespace extensions |
OLD | NEW |