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

Side by Side Diff: ppapi/shared_impl/private/ppb_font_shared.h

Issue 9391013: Make a global enum to differentiate impl & proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ 6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 class PPAPI_SHARED_EXPORT PPB_Font_Shared 27 class PPAPI_SHARED_EXPORT PPB_Font_Shared
28 : public ::ppapi::Resource, 28 : public ::ppapi::Resource,
29 public ::ppapi::thunk::PPB_Font_API { 29 public ::ppapi::thunk::PPB_Font_API {
30 public: 30 public:
31 // Validates the parameters in thee description. Can be called on any thread. 31 // Validates the parameters in thee description. Can be called on any thread.
32 static bool IsPPFontDescriptionValid(const PP_FontDescription_Dev& desc); 32 static bool IsPPFontDescriptionValid(const PP_FontDescription_Dev& desc);
33 33
34 virtual ~PPB_Font_Shared(); 34 virtual ~PPB_Font_Shared();
35 35
36 static PP_Resource CreateAsImpl(PP_Instance instance, 36 static PP_Resource Create(ResourceObjectType type,
37 const PP_FontDescription_Dev& description, 37 PP_Instance instance,
38 const ::ppapi::Preferences& prefs); 38 const PP_FontDescription_Dev& description,
39 static PP_Resource CreateAsProxy(PP_Instance instance, 39 const ::ppapi::Preferences& prefs);
40 const PP_FontDescription_Dev& description,
41 const ::ppapi::Preferences& prefs);
42 40
43 // Resource. 41 // Resource.
44 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; 42 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE;
45 43
46 // PPB_Font implementation. 44 // PPB_Font implementation.
47 virtual PP_Bool Describe(PP_FontDescription_Dev* description, 45 virtual PP_Bool Describe(PP_FontDescription_Dev* description,
48 PP_FontMetrics_Dev* metrics) OVERRIDE; 46 PP_FontMetrics_Dev* metrics) OVERRIDE;
49 virtual PP_Bool DrawTextAt(PP_Resource image_data, 47 virtual PP_Bool DrawTextAt(PP_Resource image_data,
50 const PP_TextRun_Dev* text, 48 const PP_TextRun_Dev* text,
51 const PP_Point* position, 49 const PP_Point* position,
52 uint32_t color, 50 uint32_t color,
53 const PP_Rect* clip, 51 const PP_Rect* clip,
54 PP_Bool image_data_is_opaque) OVERRIDE; 52 PP_Bool image_data_is_opaque) OVERRIDE;
55 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; 53 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE;
56 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, 54 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text,
57 int32_t pixel_position) OVERRIDE; 55 int32_t pixel_position) OVERRIDE;
58 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, 56 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text,
59 uint32_t char_offset) OVERRIDE; 57 uint32_t char_offset) OVERRIDE;
60 58
61 private: 59 private:
62 struct InitAsImpl {}; 60 PPB_Font_Shared(ResourceObjectType type,
63 struct InitAsProxy {};
64
65 // The dummy arguments control which version of Resource's constructor is
66 // called for this base class.
67 PPB_Font_Shared(const InitAsImpl&,
68 PP_Instance instance, 61 PP_Instance instance,
69 const PP_FontDescription_Dev& desc, 62 const PP_FontDescription_Dev& desc,
70 const ::ppapi::Preferences& prefs); 63 const ::ppapi::Preferences& prefs);
71 PPB_Font_Shared(const InitAsProxy&,
72 PP_Instance instance,
73 const PP_FontDescription_Dev& desc,
74 const ::ppapi::Preferences& prefs);
75
76 void Initialize(const PP_FontDescription_Dev& desc,
77 const ::ppapi::Preferences& prefs);
78 64
79 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_impl_; 65 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_impl_;
80 66
81 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Shared); 67 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Shared);
82 }; 68 };
83 69
84 } // namespace ppapi 70 } // namespace ppapi
85 71
86 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ 72 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698