Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Side by Side Diff: chrome/browser/extensions/extension_omnibox_api.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 Profile* profile, const std::string& extension_id, 75 Profile* profile, const std::string& extension_id,
76 const std::string& input, int suggest_id) { 76 const std::string& input, int suggest_id) {
77 if (!profile->GetExtensionEventRouter()->ExtensionHasEventListener( 77 if (!profile->GetExtensionEventRouter()->ExtensionHasEventListener(
78 extension_id, events::kOnInputChanged)) 78 extension_id, events::kOnInputChanged))
79 return false; 79 return false;
80 80
81 ListValue args; 81 ListValue args;
82 args.Set(0, Value::CreateStringValue(input)); 82 args.Set(0, Value::CreateStringValue(input));
83 args.Set(1, Value::CreateIntegerValue(suggest_id)); 83 args.Set(1, Value::CreateIntegerValue(suggest_id));
84 std::string json_args; 84 std::string json_args;
85 base::JSONWriter::Write(&args, false, &json_args); 85 base::JSONWriter::Write(&args, &json_args);
86 86
87 profile->GetExtensionEventRouter()->DispatchEventToExtension( 87 profile->GetExtensionEventRouter()->DispatchEventToExtension(
88 extension_id, events::kOnInputChanged, json_args, profile, GURL()); 88 extension_id, events::kOnInputChanged, json_args, profile, GURL());
89 return true; 89 return true;
90 } 90 }
91 91
92 // static 92 // static
93 void ExtensionOmniboxEventRouter::OnInputEntered( 93 void ExtensionOmniboxEventRouter::OnInputEntered(
94 Profile* profile, const std::string& extension_id, 94 Profile* profile, const std::string& extension_id,
95 const std::string& input) { 95 const std::string& input) {
96 ListValue args; 96 ListValue args;
97 args.Set(0, Value::CreateStringValue(input)); 97 args.Set(0, Value::CreateStringValue(input));
98 std::string json_args; 98 std::string json_args;
99 base::JSONWriter::Write(&args, false, &json_args); 99 base::JSONWriter::Write(&args, &json_args);
100 100
101 profile->GetExtensionEventRouter()->DispatchEventToExtension( 101 profile->GetExtensionEventRouter()->DispatchEventToExtension(
102 extension_id, events::kOnInputEntered, json_args, profile, GURL()); 102 extension_id, events::kOnInputEntered, json_args, profile, GURL());
103 103
104 content::NotificationService::current()->Notify( 104 content::NotificationService::current()->Notify(
105 chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, 105 chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED,
106 content::Source<Profile>(profile), 106 content::Source<Profile>(profile),
107 content::NotificationService::NoDetails()); 107 content::NotificationService::NoDetails());
108 } 108 }
109 109
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 // Look at the preferences to find the right launch container. If no 289 // Look at the preferences to find the right launch container. If no
290 // preference is set, launch as a regular tab. 290 // preference is set, launch as a regular tab.
291 extension_misc::LaunchContainer launch_container = 291 extension_misc::LaunchContainer launch_container =
292 service->extension_prefs()->GetLaunchContainer( 292 service->extension_prefs()->GetLaunchContainer(
293 extension, ExtensionPrefs::LAUNCH_REGULAR); 293 extension, ExtensionPrefs::LAUNCH_REGULAR);
294 294
295 Browser::OpenApplication(profile, extension, launch_container, GURL(), 295 Browser::OpenApplication(profile, extension, launch_container, GURL(),
296 disposition); 296 disposition);
297 } 297 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_message_service.cc ('k') | chrome/browser/extensions/extension_preference_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698