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

Side by Side Diff: content/public/browser/font_list_async.h

Issue 9500008: Move font_list_async.h to content/public. Switch to Pass() goodness to simplify code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix clang Created 8 years, 9 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 | « content/content_browser.gypi ('k') | no next file » | 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) 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 CONTENT_BROWSER_FONT_LIST_ASYNC_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_FONT_LIST_ASYNC_H_
6 #define CONTENT_BROWSER_FONT_LIST_ASYNC_H_ 6 #define CONTENT_PUBLIC_BROWSER_FONT_LIST_ASYNC_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
12 11
13 namespace base { 12 namespace base {
14 class ListValue; 13 class ListValue;
15 } 14 }
16 15
17 namespace content { 16 namespace content {
18 17
19 // Wraps ownership of a ListValue so we can send it across threads without
20 // having ownership problems (for example if the calling thread goes away
21 // before the callback is executed, we want the ListValue to be destroyed.
22 struct CONTENT_EXPORT FontListResult
23 : public base::RefCountedThreadSafe<FontListResult> {
24 FontListResult();
25 ~FontListResult();
26
27 scoped_ptr<base::ListValue> list;
28 };
29
30 // Retrieves the list of fonts on the system as a list of strings. It provides 18 // Retrieves the list of fonts on the system as a list of strings. It provides
31 // a non-blocking interface to GetFontList_SlowBlocking in common/. 19 // a non-blocking interface to GetFontList_SlowBlocking in common/.
32 // 20 //
33 // This function will run asynchronously on a background thread since getting 21 // This function will run asynchronously on a background thread since getting
34 // the font list from the system can be slow. This function may be called from 22 // the font list from the system can be slow. This function may be called from
35 // any thread that has a BrowserThread::ID. The callback will be executed on 23 // any thread that has a BrowserThread::ID. The callback will be executed on
36 // the calling thread. 24 // the calling thread.
37 //
38 // If the caller wants to take ownership of the ListValue, it can just do
39 // FontListResult.list.release() or use scoped_ptr.swap() because this value
40 // isn't used for anything else.
41 CONTENT_EXPORT void GetFontListAsync( 25 CONTENT_EXPORT void GetFontListAsync(
42 const base::Callback<void(scoped_refptr<FontListResult>)>& callback); 26 const base::Callback<void(scoped_ptr<base::ListValue>)>& callback);
43 27
44 } // namespace content 28 } // namespace content
45 29
46 #endif // CONTENT_BROWSER_FONT_LIST_ASYNC_H_ 30 #endif // CONTENT_PUBLIC_BROWSER_FONT_LIST_ASYNC_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698