diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 00:38:48 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-01 00:38:48 +0000 |
commit | 9f1c5060c9d5f2492662b2173884dcaea10e7c4d (patch) | |
tree | a0e0c6ec200559a0e2b895c84bb6ab2abd0c6efc /ppapi/cpp | |
parent | eac2992b2067800c1767b2ff6b14e5b70672630d (diff) | |
download | chromium_src-9f1c5060c9d5f2492662b2173884dcaea10e7c4d.zip chromium_src-9f1c5060c9d5f2492662b2173884dcaea10e7c4d.tar.gz chromium_src-9f1c5060c9d5f2492662b2173884dcaea10e7c4d.tar.bz2 |
Fix pp::View and pp::BrowserFontTrusted wrapper version checks.
BUG=107398
TEST=Existing unit-tests.
Review URL: https://chromiumcodereview.appspot.com/10454095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/trusted/browser_font_trusted.cc | 76 | ||||
-rw-r--r-- | ppapi/cpp/view.cc | 27 |
2 files changed, 53 insertions, 50 deletions
diff --git a/ppapi/cpp/trusted/browser_font_trusted.cc b/ppapi/cpp/trusted/browser_font_trusted.cc index b9f2b0d..11f3b2f 100644 --- a/ppapi/cpp/trusted/browser_font_trusted.cc +++ b/ppapi/cpp/trusted/browser_font_trusted.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,11 +17,11 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_BrowserFont_Trusted>() { - return PPB_BROWSERFONT_TRUSTED_INTERFACE; +template <> const char* interface_name<PPB_BrowserFont_Trusted_1_0>() { + return PPB_BROWSERFONT_TRUSTED_INTERFACE_1_0; } -template <> const char* interface_name<PPB_Font_Dev>() { - return PPB_FONT_DEV_INTERFACE; +template <> const char* interface_name<PPB_Font_Dev_0_6>() { + return PPB_FONT_DEV_INTERFACE_0_6; } // This class provides backwards compat for PPB_Font, which is binary @@ -133,12 +133,12 @@ BrowserFont_Trusted::BrowserFont_Trusted(PP_Resource resource) BrowserFont_Trusted::BrowserFont_Trusted( Instance* instance, const BrowserFontDescription& description) { - if (has_interface<PPB_BrowserFont_Trusted>()) { - PassRefFromConstructor(get_interface<PPB_BrowserFont_Trusted>()->Create( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + PassRefFromConstructor(get_interface<PPB_BrowserFont_Trusted_1_0>()->Create( instance->pp_instance(), &description.pp_font_description())); - } else if (!has_interface<PPB_Font_Dev>()) { - PassRefFromConstructor(get_interface<PPB_Font_Dev>()->Create( + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + PassRefFromConstructor(get_interface<PPB_Font_Dev_0_6>()->Create( instance->pp_instance(), BrowserFontDescToFontDesc(&description.pp_font_description()))); } @@ -156,10 +156,10 @@ BrowserFont_Trusted& BrowserFont_Trusted::operator=( // static Var BrowserFont_Trusted::GetFontFamilies(Instance* instance) { - if (!has_interface<PPB_Font_Dev>()) + if (!has_interface<PPB_Font_Dev_0_6>()) return Var(); return Var(PASS_REF, - get_interface<PPB_Font_Dev>()->GetFontFamilies( + get_interface<PPB_Font_Dev_0_6>()->GetFontFamilies( instance->pp_instance())); } @@ -168,12 +168,12 @@ bool BrowserFont_Trusted::Describe( PP_BrowserFont_Trusted_Metrics* metrics) const { // Be careful with ownership of the |face| string. It will come back with // a ref of 1, which we want to assign to the |face_| member of the C++ class. - if (has_interface<PPB_BrowserFont_Trusted>()) { - if (!get_interface<PPB_BrowserFont_Trusted>()->Describe( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + if (!get_interface<PPB_BrowserFont_Trusted_1_0>()->Describe( pp_resource(), &description->pp_font_description_, metrics)) return false; - } else if (!has_interface<PPB_Font_Dev>()) { - if (!get_interface<PPB_Font_Dev>()->Describe( + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + if (!get_interface<PPB_Font_Dev_0_6>()->Describe( pp_resource(), BrowserFontDescToFontDesc(&description->pp_font_description_), BrowserFontMetricsToFontMetrics(metrics))) @@ -190,8 +190,8 @@ bool BrowserFont_Trusted::DrawTextAt(ImageData* dest, uint32_t color, const Rect& clip, bool image_data_is_opaque) const { - if (has_interface<PPB_BrowserFont_Trusted>()) { - return PP_ToBool(get_interface<PPB_BrowserFont_Trusted>()->DrawTextAt( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + return PP_ToBool(get_interface<PPB_BrowserFont_Trusted_1_0>()->DrawTextAt( pp_resource(), dest->pp_resource(), &text.pp_text_run(), @@ -199,8 +199,8 @@ bool BrowserFont_Trusted::DrawTextAt(ImageData* dest, color, &clip.pp_rect(), PP_FromBool(image_data_is_opaque))); - } else if (!has_interface<PPB_Font_Dev>()) { - return PP_ToBool(get_interface<PPB_Font_Dev>()->DrawTextAt( + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + return PP_ToBool(get_interface<PPB_Font_Dev_0_6>()->DrawTextAt( pp_resource(), dest->pp_resource(), BrowserFontTextRunToFontTextRun(&text.pp_text_run()), @@ -213,12 +213,12 @@ bool BrowserFont_Trusted::DrawTextAt(ImageData* dest, } int32_t BrowserFont_Trusted::MeasureText(const BrowserFontTextRun& text) const { - if (has_interface<PPB_BrowserFont_Trusted>()) { - return get_interface<PPB_BrowserFont_Trusted>()->MeasureText( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + return get_interface<PPB_BrowserFont_Trusted_1_0>()->MeasureText( pp_resource(), &text.pp_text_run()); - } else if (!has_interface<PPB_Font_Dev>()) { - return get_interface<PPB_Font_Dev>()->MeasureText( + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + return get_interface<PPB_Font_Dev_0_6>()->MeasureText( pp_resource(), BrowserFontTextRunToFontTextRun(&text.pp_text_run())); } @@ -228,13 +228,14 @@ int32_t BrowserFont_Trusted::MeasureText(const BrowserFontTextRun& text) const { uint32_t BrowserFont_Trusted::CharacterOffsetForPixel( const BrowserFontTextRun& text, int32_t pixel_position) const { - if (has_interface<PPB_BrowserFont_Trusted>()) { - return get_interface<PPB_BrowserFont_Trusted>()->CharacterOffsetForPixel( - pp_resource(), - &text.pp_text_run(), - pixel_position); - } else if (!has_interface<PPB_Font_Dev>()) { - return get_interface<PPB_Font_Dev>()->CharacterOffsetForPixel( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + return get_interface<PPB_BrowserFont_Trusted_1_0>()-> + CharacterOffsetForPixel( + pp_resource(), + &text.pp_text_run(), + pixel_position); + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + return get_interface<PPB_Font_Dev_0_6>()->CharacterOffsetForPixel( pp_resource(), BrowserFontTextRunToFontTextRun(&text.pp_text_run()), pixel_position); @@ -245,13 +246,14 @@ uint32_t BrowserFont_Trusted::CharacterOffsetForPixel( int32_t BrowserFont_Trusted::PixelOffsetForCharacter( const BrowserFontTextRun& text, uint32_t char_offset) const { - if (has_interface<PPB_BrowserFont_Trusted>()) { - return get_interface<PPB_BrowserFont_Trusted>()->PixelOffsetForCharacter( - pp_resource(), - &text.pp_text_run(), - char_offset); - } else if (!has_interface<PPB_Font_Dev>()) { - return get_interface<PPB_Font_Dev>()->PixelOffsetForCharacter( + if (has_interface<PPB_BrowserFont_Trusted_1_0>()) { + return get_interface<PPB_BrowserFont_Trusted_1_0>()-> + PixelOffsetForCharacter( + pp_resource(), + &text.pp_text_run(), + char_offset); + } else if (!has_interface<PPB_Font_Dev_0_6>()) { + return get_interface<PPB_Font_Dev_0_6>()->PixelOffsetForCharacter( pp_resource(), BrowserFontTextRunToFontTextRun(&text.pp_text_run()), char_offset); diff --git a/ppapi/cpp/view.cc b/ppapi/cpp/view.cc index 6a4e353..68c6e311 100644 --- a/ppapi/cpp/view.cc +++ b/ppapi/cpp/view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,8 +11,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_View>() { - return PPB_VIEW_INTERFACE; +template <> const char* interface_name<PPB_View_1_0>() { + return PPB_VIEW_INTERFACE_1_0; } } // namespace @@ -24,37 +24,38 @@ View::View(PP_Resource view_resource) : Resource(view_resource) { } Rect View::GetRect() const { - if (!has_interface<PPB_View>()) + if (!has_interface<PPB_View_1_0>()) return Rect(); PP_Rect out; - if (PP_ToBool(get_interface<PPB_View>()->GetRect(pp_resource(), &out))) + if (PP_ToBool(get_interface<PPB_View_1_0>()->GetRect(pp_resource(), &out))) return Rect(out); return Rect(); } bool View::IsFullscreen() const { - if (!has_interface<PPB_View>()) + if (!has_interface<PPB_View_1_0>()) return false; - return PP_ToBool(get_interface<PPB_View>()->IsFullscreen(pp_resource())); + return PP_ToBool(get_interface<PPB_View_1_0>()->IsFullscreen(pp_resource())); } bool View::IsVisible() const { - if (!has_interface<PPB_View>()) + if (!has_interface<PPB_View_1_0>()) return false; - return PP_ToBool(get_interface<PPB_View>()->IsVisible(pp_resource())); + return PP_ToBool(get_interface<PPB_View_1_0>()->IsVisible(pp_resource())); } bool View::IsPageVisible() const { - if (!has_interface<PPB_View>()) + if (!has_interface<PPB_View_1_0>()) return true; - return PP_ToBool(get_interface<PPB_View>()->IsPageVisible(pp_resource())); + return PP_ToBool(get_interface<PPB_View_1_0>()->IsPageVisible(pp_resource())); } Rect View::GetClipRect() const { - if (!has_interface<PPB_View>()) + if (!has_interface<PPB_View_1_0>()) return Rect(); PP_Rect out; - if (PP_ToBool(get_interface<PPB_View>()->GetClipRect(pp_resource(), &out))) + if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(), + &out))) return Rect(out); return Rect(); } |