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

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

Issue 3117017: Remove deprecated wstring Get(As)String() methods from Value, etc. (Closed)
Patch Set: fix win Created 10 years, 4 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/first_run/first_run_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_bookmarks_module.h" 5 #include "chrome/browser/extensions/extension_bookmarks_module.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/bookmarks/bookmark_codec.h" 13 #include "chrome/browser/bookmarks/bookmark_codec.h"
13 #include "chrome/browser/bookmarks/bookmark_html_writer.h" 14 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 15 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_utils.h" 16 #include "chrome/browser/bookmarks/bookmark_utils.h"
16 #include "chrome/browser/browser_list.h" 17 #include "chrome/browser/browser_list.h"
17 #include "chrome/browser/extensions/extension_bookmark_helpers.h" 18 #include "chrome/browser/extensions/extension_bookmark_helpers.h"
18 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" 19 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h"
19 #include "chrome/browser/extensions/extension_message_service.h" 20 #include "chrome/browser/extensions/extension_message_service.h"
20 #include "chrome/browser/extensions/extensions_quota_service.h" 21 #include "chrome/browser/extensions/extensions_quota_service.h"
21 #include "chrome/browser/importer/importer.h" 22 #include "chrome/browser/importer/importer.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 bool GetBookmarkTreeFunction::RunImpl() { 315 bool GetBookmarkTreeFunction::RunImpl() {
315 BookmarkModel* model = profile()->GetBookmarkModel(); 316 BookmarkModel* model = profile()->GetBookmarkModel();
316 scoped_ptr<ListValue> json(new ListValue()); 317 scoped_ptr<ListValue> json(new ListValue());
317 const BookmarkNode* node = model->root_node(); 318 const BookmarkNode* node = model->root_node();
318 extension_bookmark_helpers::AddNode(node, json.get(), true); 319 extension_bookmark_helpers::AddNode(node, json.get(), true);
319 result_.reset(json.release()); 320 result_.reset(json.release());
320 return true; 321 return true;
321 } 322 }
322 323
323 bool SearchBookmarksFunction::RunImpl() { 324 bool SearchBookmarksFunction::RunImpl() {
324 std::wstring query; 325 string16 query;
325 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &query)); 326 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &query));
326 327
327 BookmarkModel* model = profile()->GetBookmarkModel(); 328 BookmarkModel* model = profile()->GetBookmarkModel();
328 ListValue* json = new ListValue(); 329 ListValue* json = new ListValue();
329 std::wstring lang = 330 std::wstring lang =
330 UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); 331 UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
331 std::vector<const BookmarkNode*> nodes; 332 std::vector<const BookmarkNode*> nodes;
332 bookmark_utils::GetBookmarksContainingText(model, query, 333 bookmark_utils::GetBookmarksContainingText(model, UTF16ToWideHack(query),
333 std::numeric_limits<int>::max(), 334 std::numeric_limits<int>::max(),
334 lang, &nodes); 335 lang, &nodes);
335 std::vector<const BookmarkNode*>::iterator i = nodes.begin(); 336 std::vector<const BookmarkNode*>::iterator i = nodes.begin();
336 for (; i != nodes.end(); ++i) { 337 for (; i != nodes.end(); ++i) {
337 const BookmarkNode* node = *i; 338 const BookmarkNode* node = *i;
338 extension_bookmark_helpers::AddNode(node, json, false); 339 extension_bookmark_helpers::AddNode(node, json, false);
339 } 340 }
340 341
341 result_.reset(json); 342 result_.reset(json);
342 return true; 343 return true;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); 819 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE);
819 return true; 820 return true;
820 } 821 }
821 822
822 void ExportBookmarksFunction::FileSelected(const FilePath& path, 823 void ExportBookmarksFunction::FileSelected(const FilePath& path,
823 int index, 824 int index,
824 void* params) { 825 void* params) {
825 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); 826 bookmark_html_writer::WriteBookmarks(profile(), path, NULL);
826 Release(); // Balanced in BookmarksIOFunction::SelectFile() 827 Release(); // Balanced in BookmarksIOFunction::SelectFile()
827 } 828 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/first_run/first_run_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698