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

Side by Side Diff: chrome/browser/spellchecker/spellcheck_host_impl.h

Issue 7919003: Remove refptr usages from SpellCheckHost (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix pointer returns. Update tests. Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/spellchecker/spellcheck_host.h" 15 #include "chrome/browser/spellchecker/spellcheck_host.h"
15 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h" 16 #include "chrome/browser/spellchecker/spellcheck_profile_provider.h"
16 #include "content/common/net/url_fetcher.h" 17 #include "content/common/net/url_fetcher.h"
17 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
19 20
20 // This class implements the SpellCheckHost interface to provide the 21 // This class implements the SpellCheckHost interface to provide the
21 // functionalities listed below: 22 // functionalities listed below:
22 // * Adding a word to the custom dictionary; 23 // * Adding a word to the custom dictionary;
23 // * Storing the custom dictionary to the file, and read it back 24 // * Storing the custom dictionary to the file, and read it back
(...skipping 15 matching lines...) Expand all
39 // can be listed using SpellCheckHost::GetAvailableLanguages() static method. 40 // can be listed using SpellCheckHost::GetAvailableLanguages() static method.
40 class SpellCheckHostImpl : public SpellCheckHost, 41 class SpellCheckHostImpl : public SpellCheckHost,
41 public URLFetcher::Delegate, 42 public URLFetcher::Delegate,
42 public content::NotificationObserver { 43 public content::NotificationObserver {
43 public: 44 public:
44 SpellCheckHostImpl(SpellCheckProfileProvider* profile, 45 SpellCheckHostImpl(SpellCheckProfileProvider* profile,
45 const std::string& language, 46 const std::string& language,
46 net::URLRequestContextGetter* request_context_getter, 47 net::URLRequestContextGetter* request_context_getter,
47 SpellCheckHostMetrics* metrics); 48 SpellCheckHostMetrics* metrics);
48 49
50 virtual ~SpellCheckHostImpl();
51
49 void Initialize(); 52 void Initialize();
50 53
51 // SpellCheckHost implementation 54 // SpellCheckHost implementation
52 virtual void UnsetProfile(); 55 virtual void UnsetProfile();
53 virtual void InitForRenderer(RenderProcessHost* process); 56 virtual void InitForRenderer(RenderProcessHost* process);
54 virtual void AddWord(const std::string& word); 57 virtual void AddWord(const std::string& word);
55 virtual const base::PlatformFile& GetDictionaryFile() const; 58 virtual const base::PlatformFile& GetDictionaryFile() const;
56 virtual const std::string& GetLanguage() const; 59 virtual const std::string& GetLanguage() const;
57 virtual bool IsUsingPlatformChecker() const; 60 virtual bool IsUsingPlatformChecker() const;
58 61
59 private: 62 private:
60 typedef SpellCheckProfileProvider::CustomWordList CustomWordList; 63 typedef SpellCheckProfileProvider::CustomWordList CustomWordList;
61 64
62 // These two classes can destruct us. 65 // These two classes can destruct us.
63 friend class BrowserThread; 66 friend class BrowserThread;
64 friend class DeleteTask<SpellCheckHostImpl>; 67 friend class DeleteTask<SpellCheckHostImpl>;
65 68
66 virtual ~SpellCheckHostImpl();
67
68 // Figure out the location for the dictionary. This is only non-trivial for 69 // Figure out the location for the dictionary. This is only non-trivial for
69 // Windows: 70 // Windows:
70 // The default place whether the spellcheck dictionary can reside is 71 // The default place whether the spellcheck dictionary can reside is
71 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations, 72 // chrome::DIR_APP_DICTIONARIES. However, for systemwide installations,
72 // this directory may not have permissions for download. In that case, the 73 // this directory may not have permissions for download. In that case, the
73 // alternate directory for download is chrome::DIR_USER_DATA. 74 // alternate directory for download is chrome::DIR_USER_DATA.
74 void InitializeDictionaryLocation(); 75 void InitializeDictionaryLocation();
75 76
76 // Load and parse the custom words dictionary and open the bdic file. 77 // Load and parse the custom words dictionary and open the bdic file.
77 // Executed on the file thread. 78 // Executed on the file thread.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 net::URLRequestContextGetter* request_context_getter_; 155 net::URLRequestContextGetter* request_context_getter_;
155 156
156 // Used for downloading the dictionary file. 157 // Used for downloading the dictionary file.
157 scoped_ptr<URLFetcher> fetcher_; 158 scoped_ptr<URLFetcher> fetcher_;
158 159
159 content::NotificationRegistrar registrar_; 160 content::NotificationRegistrar registrar_;
160 161
161 // An optional metrics counter given by the constructor. 162 // An optional metrics counter given by the constructor.
162 SpellCheckHostMetrics* metrics_; 163 SpellCheckHostMetrics* metrics_;
163 164
165 base::WeakPtrFactory<SpellCheckHostImpl> weak_ptr_factory_;
166
164 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl); 167 DISALLOW_COPY_AND_ASSIGN(SpellCheckHostImpl);
165 }; 168 };
166 169
167 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_ 170 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698