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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool ExtensionOmniboxEventRouter::OnInputChanged( | 106 bool ExtensionOmniboxEventRouter::OnInputChanged( |
107 Profile* profile, const std::string& extension_id, | 107 Profile* profile, const std::string& extension_id, |
108 const std::string& input, int suggest_id) { | 108 const std::string& input, int suggest_id) { |
109 EventRouter* event_router = EventRouter::Get(profile); | 109 EventRouter* event_router = EventRouter::Get(profile); |
110 if (!event_router->ExtensionHasEventListener( | 110 if (!event_router->ExtensionHasEventListener( |
111 extension_id, omnibox::OnInputChanged::kEventName)) | 111 extension_id, omnibox::OnInputChanged::kEventName)) |
112 return false; | 112 return false; |
113 | 113 |
114 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 114 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
115 args->Set(0, new base::StringValue(input)); | 115 args->Set(0, new base::StringValue(input)); |
116 args->Set(1, new base::FundamentalValue(suggest_id)); | 116 args->Set(1, new base::Value(suggest_id)); |
117 | 117 |
118 std::unique_ptr<Event> event = base::MakeUnique<Event>( | 118 std::unique_ptr<Event> event = base::MakeUnique<Event>( |
119 events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName, | 119 events::OMNIBOX_ON_INPUT_CHANGED, omnibox::OnInputChanged::kEventName, |
120 std::move(args)); | 120 std::move(args)); |
121 event->restrict_to_browser_context = profile; | 121 event->restrict_to_browser_context = profile; |
122 event_router->DispatchEventToExtension(extension_id, std::move(event)); | 122 event_router->DispatchEventToExtension(extension_id, std::move(event)); |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 // static | 126 // static |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 for (size_t i = 0; i < description_styles.size(); ++i) { | 375 for (size_t i = 0; i < description_styles.size(); ++i) { |
376 if (description_styles[i].offset > placeholder) | 376 if (description_styles[i].offset > placeholder) |
377 description_styles[i].offset += replacement.length() - 2; | 377 description_styles[i].offset += replacement.length() - 2; |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 match->contents.assign(description); | 381 match->contents.assign(description); |
382 } | 382 } |
383 | 383 |
384 } // namespace extensions | 384 } // namespace extensions |
OLD | NEW |