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

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

Issue 7919003: Remove refptr usages from SpellCheckHost (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 3 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_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_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/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
Hironori Bono 2011/10/14 10:57:04 nit: we do not need this line any longer once we r
14 #include "base/platform_file.h" 15 #include "base/platform_file.h"
15 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
16 17
17 namespace base { 18 namespace base {
18 class WaitableEvent; 19 class WaitableEvent;
19 } 20 }
20 21
21 class Profile; 22 class Profile;
22 class RenderProcessHost; 23 class RenderProcessHost;
23 class SpellCheckHostMetrics; 24 class SpellCheckHostMetrics;
(...skipping 17 matching lines...) Expand all
41 // The following snippet describes how to use this class, 42 // The following snippet describes how to use this class,
42 // std::vector<std::string> languages; 43 // std::vector<std::string> languages;
43 // SpellCheckHost::GetSpellCheckLanguages(profile_, &languages); 44 // SpellCheckHost::GetSpellCheckLanguages(profile_, &languages);
44 // spellcheck_host_ = SpellCheckHost::Create( 45 // spellcheck_host_ = SpellCheckHost::Create(
45 // observer, languages[0], req_getter); 46 // observer, languages[0], req_getter);
46 // 47 //
47 // The class is intended to be owned by SpellCheckProfile so users should 48 // The class is intended to be owned by SpellCheckProfile so users should
48 // retrieve the instance via Profile::GetSpellCheckHost(). 49 // retrieve the instance via Profile::GetSpellCheckHost().
49 // Users should not hold the reference over the function scope because 50 // Users should not hold the reference over the function scope because
50 // the instance can be invalidated during the browser's lifecycle. 51 // the instance can be invalidated during the browser's lifecycle.
51 class SpellCheckHost 52 class SpellCheckHost {
52 : public base::RefCountedThreadSafe<SpellCheckHost,
53 BrowserThread::DeleteOnFileThread> {
54 public: 53 public:
55 // Event types used for reporting the status of this class and its derived 54 // Event types used for reporting the status of this class and its derived
56 // classes to browser tests. 55 // classes to browser tests.
57 enum EventType { 56 enum EventType {
58 BDICT_NOTINITIALIZED, 57 BDICT_NOTINITIALIZED,
59 BDICT_CORRUPTED, 58 BDICT_CORRUPTED,
60 }; 59 };
61 60
62 virtual ~SpellCheckHost() {} 61 virtual ~SpellCheckHost() {}
63 62
64 // Creates the instance of SpellCheckHost implementation object. 63 // Creates the instance of SpellCheckHost implementation object.
65 static scoped_refptr<SpellCheckHost> Create( 64 static scoped_ptr<SpellCheckHost> Create(
Hironori Bono 2011/10/14 10:57:04 We can change this return type to SpellCheckHost*
66 SpellCheckProfileProvider* profile, 65 SpellCheckProfileProvider* profile,
67 const std::string& language, 66 const std::string& language,
68 net::URLRequestContextGetter* request_context_getter, 67 net::URLRequestContextGetter* request_context_getter,
69 SpellCheckHostMetrics* metrics); 68 SpellCheckHostMetrics* metrics);
70 69
71 // Clears a profile which is set on creation. 70 // Clears a profile which is set on creation.
72 // Used to prevent calling back to a deleted object. 71 // Used to prevent calling back to a deleted object.
73 virtual void UnsetProfile() = 0; 72 virtual void UnsetProfile() = 0;
74 73
75 // Pass the renderer some basic intialization information. Note that the 74 // Pass the renderer some basic intialization information. Note that the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 112
114 // Attaches an event so browser tests can listen the status events. 113 // Attaches an event so browser tests can listen the status events.
115 static void AttachStatusEvent(base::WaitableEvent* status_event); 114 static void AttachStatusEvent(base::WaitableEvent* status_event);
116 115
117 // Waits until a spellchecker updates its status. This function returns 116 // Waits until a spellchecker updates its status. This function returns
118 // immediately when we do not set an event to |status_event_|. 117 // immediately when we do not set an event to |status_event_|.
119 static EventType WaitStatusEvent(); 118 static EventType WaitStatusEvent();
120 }; 119 };
121 120
122 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_ 121 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/spellchecker/spellcheck_host.cc » ('j') | chrome/browser/spellchecker/spellcheck_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698