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

Side by Side Diff: chrome/browser/dom_ui/new_tab_page_sync_handler.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
« no previous file with comments | « chrome/browser/cookies_table_model.cc ('k') | chrome/browser/download/download_file.h » ('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) 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 #if defined(BROWSER_SYNC) 5 #if defined(BROWSER_SYNC)
6 6
7 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" 7 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/json_writer.h" 10 #include "base/json_writer.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/net/chrome_url_request_context.h"
13 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
14 #include "chrome/browser/renderer_host/render_view_host.h" 15 #include "chrome/browser/renderer_host/render_view_host.h"
15 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "chrome/common/pref_service.h" 18 #include "chrome/common/pref_service.h"
18 #include "grit/browser_resources.h" 19 #include "grit/browser_resources.h"
19 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
20 #include "net/base/cookie_monster.h" 21 #include "net/base/cookie_monster.h"
21 #include "net/url_request/url_request_context.h" 22 #include "net/url_request/url_request_context.h"
22 23
(...skipping 21 matching lines...) Expand all
44 45
45 // Filters to select Google GAIA cookies. 46 // Filters to select Google GAIA cookies.
46 static const GoogleCookieFilter kGAIACookieFilters[] = { 47 static const GoogleCookieFilter kGAIACookieFilters[] = {
47 { "http://.google.com/", "SID=" }, // Gmail. 48 { "http://.google.com/", "SID=" }, // Gmail.
48 // Add filters here for other interesting cookies that should result in 49 // Add filters here for other interesting cookies that should result in
49 // showing the promotions (e.g ASIDAS for dasher accounts). 50 // showing the promotions (e.g ASIDAS for dasher accounts).
50 }; 51 };
51 52
52 bool IsGoogleGAIACookieInstalled() { 53 bool IsGoogleGAIACookieInstalled() {
53 for (size_t i = 0; i < arraysize(kGAIACookieFilters); ++i) { 54 for (size_t i = 0; i < arraysize(kGAIACookieFilters); ++i) {
54 URLRequestContext* context = Profile::GetDefaultRequestContext(); 55 // Since we are running on the UI thread don't call GetURLRequestContext().
55 net::CookieStore* store = context->cookie_store(); 56 net::CookieStore* store =
57 Profile::GetDefaultRequestContext()->GetCookieStore();
56 GURL url(kGAIACookieFilters[i].url); 58 GURL url(kGAIACookieFilters[i].url);
57 net::CookieOptions options; 59 net::CookieOptions options;
58 options.set_include_httponly(); // The SID cookie might be httponly. 60 options.set_include_httponly(); // The SID cookie might be httponly.
59 std::string cookies = store->GetCookiesWithOptions(url, options); 61 std::string cookies = store->GetCookiesWithOptions(url, options);
60 std::vector<std::string> cookie_list; 62 std::vector<std::string> cookie_list;
61 SplitString(cookies, ';', &cookie_list); 63 SplitString(cookies, ';', &cookie_list);
62 for (std::vector<std::string>::iterator current = cookie_list.begin(); 64 for (std::vector<std::string>::iterator current = cookie_list.begin();
63 current != cookie_list.end(); 65 current != cookie_list.end();
64 ++current) { 66 ++current) {
65 size_t position = 67 size_t position =
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } else { 223 } else {
222 value.SetBoolean(L"linkurlisset", true); 224 value.SetBoolean(L"linkurlisset", true);
223 value.SetString(L"linkurl", linkurl); 225 value.SetString(L"linkurl", linkurl);
224 } 226 }
225 } 227 }
226 } 228 }
227 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); 229 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value);
228 } 230 }
229 231
230 #endif // defined(BROWSER_SYNC) 232 #endif // defined(BROWSER_SYNC)
OLDNEW
« no previous file with comments | « chrome/browser/cookies_table_model.cc ('k') | chrome/browser/download/download_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698