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

Side by Side Diff: chrome/browser/spellcheck_host.h

Issue 387055: Always destruct url request context getter on io thread.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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/net/url_request_context_getter.h ('k') | chrome/browser/spellcheck_host.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_SPELLCHECK_HOST_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECK_HOST_H_
6 #define CHROME_BROWSER_SPELLCHECK_HOST_H_ 6 #define CHROME_BROWSER_SPELLCHECK_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // The default place whether the spellcheck dictionary can reside is 57 // The default place whether the spellcheck dictionary can reside is
58 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, 58 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations,
59 // this directory may not have permissions for download. In that case, the 59 // this directory may not have permissions for download. In that case, the
60 // alternate directory for download is chrome::DIR_USER_DATA. 60 // alternate directory for download is chrome::DIR_USER_DATA.
61 void InitializeDictionaryLocation(); 61 void InitializeDictionaryLocation();
62 62
63 // Load and parse the custom words dictionary and open the bdic file. 63 // Load and parse the custom words dictionary and open the bdic file.
64 // Executed on the file thread. 64 // Executed on the file thread.
65 void InitializeInternal(); 65 void InitializeInternal();
66 66
67 void InitializeOnFileThread();
68
67 // Inform |observer_| that initialization has finished. 69 // Inform |observer_| that initialization has finished.
68 void InformObserverOfInitialization(); 70 void InformObserverOfInitialization();
69 71
70 // If |bdict_file_| is missing, we attempt to download it. 72 // If |bdict_file_| is missing, we attempt to download it.
71 void DownloadDictionary(); 73 void DownloadDictionary();
72 74
73 // Write a custom dictionary addition to disk. 75 // Write a custom dictionary addition to disk.
74 void WriteWordToCustomDictionary(const std::string& word); 76 void WriteWordToCustomDictionary(const std::string& word);
75 77
76 // URLFetcher::Delegate implementation. Called when we finish downloading the 78 // URLFetcher::Delegate implementation. Called when we finish downloading the
77 // spellcheck dictionary; saves the dictionary to |data_|. 79 // spellcheck dictionary; saves the dictionary to |data_|.
78 virtual void OnURLFetchComplete(const URLFetcher* source, 80 virtual void OnURLFetchComplete(const URLFetcher* source,
79 const GURL& url, 81 const GURL& url,
80 const URLRequestStatus& status, 82 const URLRequestStatus& status,
81 int response_code, 83 int response_code,
82 const ResponseCookies& cookies, 84 const ResponseCookies& cookies,
83 const std::string& data); 85 const std::string& data);
84 86
87 // Saves |data_| to disk. Run on the file thread.
88 void SaveDictionaryData();
89
85 // May be NULL. 90 // May be NULL.
86 Observer* observer_; 91 Observer* observer_;
87 92
88 // The desired location of the dictionary file (whether or not t exists yet). 93 // The desired location of the dictionary file (whether or not t exists yet).
89 FilePath bdict_file_path_; 94 FilePath bdict_file_path_;
90 95
91 // The location of the custom words file. 96 // The location of the custom words file.
92 FilePath custom_dictionary_file_; 97 FilePath custom_dictionary_file_;
93 98
94 // The language of the dictionary file. 99 // The language of the dictionary file.
95 std::string language_; 100 std::string language_;
96 101
97 // The file descriptor/handle for the dictionary file. 102 // The file descriptor/handle for the dictionary file.
98 base::PlatformFile file_; 103 base::PlatformFile file_;
99 104
100 // In-memory cache of the custom words file. 105 // In-memory cache of the custom words file.
101 std::vector<std::string> custom_words_; 106 std::vector<std::string> custom_words_;
102 107
103 // We don't want to attempt to download a missing dictionary file more than 108 // We don't want to attempt to download a missing dictionary file more than
104 // once. 109 // once.
105 bool tried_to_download_; 110 bool tried_to_download_;
106 111
107 // Used for downloading the dictionary file. 112 // Data received from the dictionary download.
108 scoped_refptr<URLRequestContextGetter> request_context_getter_; 113 std::string data_;
114
115 // Used for downloading the dictionary file. We don't hold a reference, and
116 // it is only valid to use it on the UI thread.
117 URLRequestContextGetter* request_context_getter_;
109 118
110 // Used for downloading the dictionary file. 119 // Used for downloading the dictionary file.
111 scoped_ptr<URLFetcher> fetcher_; 120 scoped_ptr<URLFetcher> fetcher_;
112 }; 121 };
113 122
114 #endif // CHROME_BROWSER_SPELLCHECK_HOST_H_ 123 #endif // CHROME_BROWSER_SPELLCHECK_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_context_getter.h ('k') | chrome/browser/spellcheck_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698