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

Side by Side Diff: chrome/browser/importer/toolbar_importer.cc

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/importer/toolbar_importer.h" 5 #include "chrome/browser/importer/toolbar_importer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "chrome/browser/first_run.h" 12 #include "chrome/browser/first_run.h"
13 #include "chrome/browser/importer/importer_bridge.h" 13 #include "chrome/browser/importer/importer_bridge.h"
14 #include "chrome/browser/net/url_request_context_getter.h"
14 #include "chrome/common/libxml_utils.h" 15 #include "chrome/common/libxml_utils.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "net/base/cookie_monster.h" 17 #include "net/base/cookie_monster.h"
17 #include "net/base/data_url.h" 18 #include "net/base/data_url.h"
18 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
19 20
20 // 21 //
21 // ToolbarImporterUtils 22 // ToolbarImporterUtils
22 // 23 //
23 static const char* kGoogleDomainUrl = "http://.google.com/"; 24 static const char* kGoogleDomainUrl = "http://.google.com/";
24 static const wchar_t kSplitStringToken = L';'; 25 static const wchar_t kSplitStringToken = L';';
25 static const char* kGoogleDomainSecureCookieId = "SID="; 26 static const char* kGoogleDomainSecureCookieId = "SID=";
26 27
27 bool toolbar_importer_utils::IsGoogleGAIACookieInstalled() { 28 bool toolbar_importer_utils::IsGoogleGAIACookieInstalled() {
28 URLRequestContext* context = Profile::GetDefaultRequestContext(); 29 net::CookieStore* store =
29 net::CookieStore* store = context->cookie_store(); 30 Profile::GetDefaultRequestContext()->GetCookieStore();
30 GURL url(kGoogleDomainUrl); 31 GURL url(kGoogleDomainUrl);
31 net::CookieOptions options; 32 net::CookieOptions options;
32 options.set_include_httponly(); // The SID cookie might be httponly. 33 options.set_include_httponly(); // The SID cookie might be httponly.
33 std::string cookies = store->GetCookiesWithOptions(url, options); 34 std::string cookies = store->GetCookiesWithOptions(url, options);
34 std::vector<std::string> cookie_list; 35 std::vector<std::string> cookie_list;
35 SplitString(cookies, kSplitStringToken, &cookie_list); 36 SplitString(cookies, kSplitStringToken, &cookie_list);
36 for (std::vector<std::string>::iterator current = cookie_list.begin(); 37 for (std::vector<std::string>::iterator current = cookie_list.begin();
37 current != cookie_list.end(); 38 current != cookie_list.end();
38 ++current) { 39 ++current) {
39 size_t position = (*current).find(kGoogleDomainSecureCookieId); 40 size_t position = (*current).find(kGoogleDomainSecureCookieId);
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 void Toolbar5Importer::AddBookmarksToChrome( 578 void Toolbar5Importer::AddBookmarksToChrome(
578 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) { 579 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) {
579 if (!bookmarks.empty() && !cancelled()) { 580 if (!bookmarks.empty() && !cancelled()) {
580 const std::wstring& first_folder_name = 581 const std::wstring& first_folder_name =
581 l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR); 582 l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR);
582 int options = ProfileWriter::ADD_IF_UNIQUE | 583 int options = ProfileWriter::ADD_IF_UNIQUE |
583 (import_to_bookmark_bar() ? ProfileWriter::IMPORT_TO_BOOKMARK_BAR : 0); 584 (import_to_bookmark_bar() ? ProfileWriter::IMPORT_TO_BOOKMARK_BAR : 0);
584 bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options); 585 bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options);
585 } 586 }
586 } 587 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/cookies_view_unittest.cc ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698