summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 08:16:22 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 08:16:22 +0000
commitffadb717d9ab2138fde9dc238ad697449da4d75e (patch)
treeda760106251c583911e476d177c2ed981ecfe211 /ppapi/cpp
parent8de46cee7669abb07f6d3e192f5850872187250b (diff)
downloadchromium_src-ffadb717d9ab2138fde9dc238ad697449da4d75e.zip
chromium_src-ffadb717d9ab2138fde9dc238ad697449da4d75e.tar.gz
chromium_src-ffadb717d9ab2138fde9dc238ad697449da4d75e.tar.bz2
Pepper: Add a function to PPB_Flash to check if a rect is topmost.
This is needed for "Flash dialogs". This is dependent on https://bugs.webkit.org/show_bug.cgi?id=78166 . TEST=check the example plugin (under flash_topmost) Review URL: http://codereview.chromium.org/9369003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/private/flash.cc72
-rw-r--r--ppapi/cpp/private/flash.h6
2 files changed, 75 insertions, 3 deletions
diff --git a/ppapi/cpp/private/flash.cc b/ppapi/cpp/private/flash.cc
index bab400b..19e2680 100644
--- a/ppapi/cpp/private/flash.cc
+++ b/ppapi/cpp/private/flash.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.
@@ -25,6 +25,10 @@ template <> const char* interface_name<PPB_Flash>() {
return PPB_FLASH_INTERFACE;
}
+template <> const char* interface_name<PPB_Flash_12_0>() {
+ return PPB_FLASH_INTERFACE_12_0;
+}
+
template <> const char* interface_name<PPB_Flash_11>() {
return PPB_FLASH_INTERFACE_11_0;
}
@@ -35,7 +39,9 @@ namespace flash {
// static
bool Flash::IsAvailable() {
- return has_interface<PPB_Flash>() || has_interface<PPB_Flash_11>();
+ return has_interface<PPB_Flash>() ||
+ has_interface<PPB_Flash_12_0>();
+ has_interface<PPB_Flash_11>();
}
// static
@@ -43,6 +49,9 @@ void Flash::SetInstanceAlwaysOnTop(Instance* instance, bool on_top) {
if (has_interface<PPB_Flash>()) {
get_interface<PPB_Flash>()->SetInstanceAlwaysOnTop(instance->pp_instance(),
PP_FromBool(on_top));
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ get_interface<PPB_Flash_12_0>()->SetInstanceAlwaysOnTop(
+ instance->pp_instance(), PP_FromBool(on_top));
} else if (has_interface<PPB_Flash_11>()) {
get_interface<PPB_Flash_11>()->SetInstanceAlwaysOnTop(
instance->pp_instance(), PP_FromBool(on_top));
@@ -75,6 +84,19 @@ bool Flash::DrawGlyphs(Instance* instance,
glyph_count,
glyph_indices,
glyph_advances));
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash_12_0>()->DrawGlyphs(
+ instance->pp_instance(),
+ image->pp_resource(),
+ &font_desc.pp_font_description(),
+ color,
+ &position.pp_point(),
+ &clip.pp_rect(),
+ transformation,
+ PP_FromBool(allow_subpixel_aa),
+ glyph_count,
+ glyph_indices,
+ glyph_advances));
} else if (has_interface<PPB_Flash_11>()) {
rv = PP_ToBool(get_interface<PPB_Flash_11>()->DrawGlyphs(
instance->pp_instance(),
@@ -98,6 +120,10 @@ Var Flash::GetProxyForURL(Instance* instance, const std::string& url) {
rv = Var(Var::PassRef(),
get_interface<PPB_Flash>()->GetProxyForURL(instance->pp_instance(),
url.c_str()));
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ rv = Var(Var::PassRef(),
+ get_interface<PPB_Flash_12_0>()->GetProxyForURL(
+ instance->pp_instance(), url.c_str()));
} else if (has_interface<PPB_Flash_11>()) {
rv = Var(Var::PassRef(),
get_interface<PPB_Flash_11>()->GetProxyForURL(
@@ -115,6 +141,11 @@ int32_t Flash::Navigate(const URLRequestInfo& request_info,
rv = get_interface<PPB_Flash>()->Navigate(request_info.pp_resource(),
target.c_str(),
PP_FromBool(from_user_action));
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ rv = get_interface<PPB_Flash_12_0>()->Navigate(
+ request_info.pp_resource(),
+ target.c_str(),
+ PP_FromBool(from_user_action));
} else if (has_interface<PPB_Flash_11>()) {
rv = get_interface<PPB_Flash_11>()->Navigate(request_info.pp_resource(),
target.c_str(),
@@ -127,6 +158,8 @@ int32_t Flash::Navigate(const URLRequestInfo& request_info,
void Flash::RunMessageLoop(Instance* instance) {
if (has_interface<PPB_Flash>())
get_interface<PPB_Flash>()->RunMessageLoop(instance->pp_instance());
+ else if (has_interface<PPB_Flash_12_0>())
+ get_interface<PPB_Flash_12_0>()->RunMessageLoop(instance->pp_instance());
else if (has_interface<PPB_Flash_11>())
get_interface<PPB_Flash_11>()->RunMessageLoop(instance->pp_instance());
}
@@ -135,6 +168,8 @@ void Flash::RunMessageLoop(Instance* instance) {
void Flash::QuitMessageLoop(Instance* instance) {
if (has_interface<PPB_Flash>())
get_interface<PPB_Flash>()->QuitMessageLoop(instance->pp_instance());
+ else if (has_interface<PPB_Flash_12_0>())
+ get_interface<PPB_Flash_12_0>()->QuitMessageLoop(instance->pp_instance());
else if (has_interface<PPB_Flash_11>())
get_interface<PPB_Flash_11>()->QuitMessageLoop(instance->pp_instance());
}
@@ -145,6 +180,9 @@ double Flash::GetLocalTimeZoneOffset(Instance* instance, PP_Time t) {
if (has_interface<PPB_Flash>()) {
rv = get_interface<PPB_Flash>()->GetLocalTimeZoneOffset(
instance->pp_instance(), t);
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ rv = get_interface<PPB_Flash_12_0>()->GetLocalTimeZoneOffset(
+ instance->pp_instance(), t);
} else if (has_interface<PPB_Flash_11>()) {
rv = get_interface<PPB_Flash_11>()->GetLocalTimeZoneOffset(
instance->pp_instance(), t);
@@ -159,6 +197,10 @@ Var Flash::GetCommandLineArgs(Module* module) {
rv = Var(Var::PassRef(),
get_interface<PPB_Flash>()->GetCommandLineArgs(
module->pp_module()));
+ } else if (has_interface<PPB_Flash_12_0>()) {
+ rv = Var(Var::PassRef(),
+ get_interface<PPB_Flash_12_0>()->GetCommandLineArgs(
+ module->pp_module()));
} else if (has_interface<PPB_Flash_11>()) {
rv = Var(Var::PassRef(),
get_interface<PPB_Flash_11>()->GetCommandLineArgs(
@@ -171,6 +213,32 @@ Var Flash::GetCommandLineArgs(Module* module) {
void Flash::PreloadFontWin(const void* logfontw) {
if (has_interface<PPB_Flash>())
get_interface<PPB_Flash>()->PreloadFontWin(logfontw);
+ else if (has_interface<PPB_Flash_12_0>())
+ get_interface<PPB_Flash_12_0>()->PreloadFontWin(logfontw);
+}
+
+// static
+bool Flash::IsRectTopmost(Instance* instance, const Rect& rect) {
+ bool rv = false;
+ if (has_interface<PPB_Flash>()) {
+ rv = PP_ToBool(get_interface<PPB_Flash>()->IsRectTopmost(
+ instance->pp_instance(), &rect.pp_rect()));
+ }
+ return rv;
+}
+
+// static
+int32_t Flash::InvokePrinting(Instance* instance) {
+ int32_t rv = PP_ERROR_NOTSUPPORTED;
+ if (has_interface<PPB_Flash>())
+ rv = get_interface<PPB_Flash>()->InvokePrinting(instance->pp_instance());
+ return rv;
+}
+
+// static
+void Flash::UpdateActivity(Instance* instance) {
+ if (has_interface<PPB_Flash>())
+ get_interface<PPB_Flash>()->UpdateActivity(instance->pp_instance());
}
} // namespace flash
diff --git a/ppapi/cpp/private/flash.h b/ppapi/cpp/private/flash.h
index e47bff0..e60cc01 100644
--- a/ppapi/cpp/private/flash.h
+++ b/ppapi/cpp/private/flash.h
@@ -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.
@@ -51,6 +51,10 @@ class Flash {
static double GetLocalTimeZoneOffset(Instance* instance, PP_Time t);
static Var GetCommandLineArgs(Module* module);
static void PreloadFontWin(const void* logfontw);
+ static bool IsRectTopmost(Instance* instance, const Rect& rect);
+ static int32_t InvokePrinting(Instance* instance);
+ static void UpdateActivity(Instance* instance);
+
};
} // namespace flash