summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 23:32:51 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 23:32:51 +0000
commit4e5c1084d36e100572b2bcee0c10caf35e0f2367 (patch)
tree2b1b80512adcbbf1c7552cf4c25d8905cbd13326
parent0cbd2d367068d9b5cc00cf39238f0277cef5ba15 (diff)
downloadchromium_src-4e5c1084d36e100572b2bcee0c10caf35e0f2367.zip
chromium_src-4e5c1084d36e100572b2bcee0c10caf35e0f2367.tar.gz
chromium_src-4e5c1084d36e100572b2bcee0c10caf35e0f2367.tar.bz2
Make gears_integration.cc compile on Posix. Change the GearsCreateShortcut callback to use GearsShortCutData2.
Review URL: http://codereview.chromium.org/20412 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9918 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.scons1
-rw-r--r--chrome/browser/chrome_plugin_host.cc6
-rw-r--r--chrome/browser/gears_integration.cc15
-rw-r--r--chrome/browser/gears_integration.h7
-rw-r--r--chrome/browser/tab_contents/web_contents.cc9
-rw-r--r--chrome/browser/tab_contents/web_contents.h4
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj2
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc5
-rw-r--r--chrome/common/temp_scaffolding_stubs.h5
9 files changed, 32 insertions, 22 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index a190db0..9d3f3d9 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -699,7 +699,6 @@ if not env.Bit('windows'):
'external_protocol_handler.cc',
'external_tab_container.cc',
'first_run.cc',
- 'gears_integration.cc',
'hang_monitor/hung_plugin_action.cc',
'hang_monitor/hung_window_detector.cc',
'history_tab_ui.cc',
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 9b67490..88fd40e 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -412,6 +412,7 @@ CPError STDCALL CPB_ShowHtmlDialog(
ChromePluginLib* plugin = ChromePluginLib::FromCPID(id);
CHECK(plugin);
+#if defined(OS_WIN)
HWND parent_hwnd = reinterpret_cast<HWND>(static_cast<uintptr_t>(context));
PluginService* service = PluginService::GetInstance();
if (!service)
@@ -421,6 +422,11 @@ CPError STDCALL CPB_ShowHtmlDialog(
new ModelessHtmlDialogDelegate(GURL(url), width, height, json_arguments,
plugin_context, plugin, main_message_loop,
parent_hwnd);
+#else
+ // TODO(port): port ModelessHtmlDialogDelegate
+ NOTIMPLEMENTED();
+#endif
+
return CPERR_SUCCESS;
}
diff --git a/chrome/browser/gears_integration.cc b/chrome/browser/gears_integration.cc
index 0801cd6..4017899 100644
--- a/chrome/browser/gears_integration.cc
+++ b/chrome/browser/gears_integration.cc
@@ -94,9 +94,9 @@ inline void EnsureStringValidPathComponent(StringT &s) {
s.resize(kUserPathComponentMaxChars);
}
-void GearsSettingsPressed(HWND parent_hwnd) {
+void GearsSettingsPressed(gfx::NativeWindow parent_wnd) {
CPBrowsingContext context = static_cast<CPBrowsingContext>(
- reinterpret_cast<uintptr_t>(parent_hwnd));
+ reinterpret_cast<uintptr_t>(parent_wnd));
CPHandleCommand(GEARSPLUGINCOMMAND_SHOW_SETTINGS, NULL, context);
}
@@ -142,8 +142,8 @@ class CreateShortcutCommand : public CPCommandInterface {
: name_(name), url_(url), description_(description),
orig_name_(orig_name), callback_(callback),
calling_loop_(MessageLoop::current()) {
- // shortcut_data_ has the same lifetime as our strings, so we just point it
- // at their internal data.
+ // shortcut_data_ has the same lifetime as our strings, so we just
+ // point it at their internal data.
memset(&shortcut_data_, 0, sizeof(shortcut_data_));
shortcut_data_.name = name_.c_str();
shortcut_data_.url = url_.c_str();
@@ -203,8 +203,7 @@ class CreateShortcutCommand : public CPCommandInterface {
// so our name will potentially differ. This is relevant because we store
// some prefs keyed off the webapp name.
shortcut_data_.name = shortcut_data_.orig_name;
- callback_->Run(*reinterpret_cast<GearsShortcutData*>(&shortcut_data_),
- retval == CPERR_SUCCESS);
+ callback_->Run(shortcut_data_, retval == CPERR_SUCCESS);
delete this;
}
@@ -227,9 +226,11 @@ class CreateShortcutCommand : public CPCommandInterface {
// Allows InvokeLater without adding refcounting. The object is only deleted
// when its last InvokeLater is run anyway.
+template<>
void RunnableMethodTraits<CreateShortcutCommand>::RetainCallee(
CreateShortcutCommand* remover) {
}
+template<>
void RunnableMethodTraits<CreateShortcutCommand>::ReleaseCallee(
CreateShortcutCommand* remover) {
}
@@ -299,9 +300,11 @@ class QueryShortcutsCommand : public CPCommandInterface {
// Allows InvokeLater without adding refcounting. The object is only deleted
// when its last InvokeLater is run anyway.
+template<>
void RunnableMethodTraits<QueryShortcutsCommand>::RetainCallee(
QueryShortcutsCommand* remover) {
}
+template<>
void RunnableMethodTraits<QueryShortcutsCommand>::ReleaseCallee(
QueryShortcutsCommand* remover) {
}
diff --git a/chrome/browser/gears_integration.h b/chrome/browser/gears_integration.h
index 708b43d..f6832ba 100644
--- a/chrome/browser/gears_integration.h
+++ b/chrome/browser/gears_integration.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/gfx/native_widget_types.h"
#include "base/task.h"
#include "chrome/common/gears_api.h"
@@ -27,16 +28,16 @@ struct GearsCreateShortcutData : public GearsShortcutData2 {
CPCommandInterface* command_interface;
};
-// Called when the Gears Settings button is pressed. |parent_hwnd| is the
+// Called when the Gears Settings button is pressed. |parent_wnd| is the
// window the Gears Settings dialog should be parented to.
-void GearsSettingsPressed(HWND parent_hwnd);
+void GearsSettingsPressed(gfx::NativeWindow parent_wnd);
// Calls into the Gears API to create a shortcut with the given parameters.
// 'app_info' is the optional information provided by the page. If any info is
// missing, we fallback to the given fallback params. 'fallback_icon' must be a
// 16x16 favicon. 'callback' will be called with a value indicating whether the
// shortcut has been created successfully.
-typedef Callback2<const GearsShortcutData&, bool>::Type
+typedef Callback2<const GearsShortcutData2&, bool>::Type
GearsCreateShortcutCallback;
void GearsCreateShortcut(
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 95ca5b7..7f6cc79 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/dom_operation_notification_details.h"
+#include "chrome/browser/gears_integration.h"
#include "chrome/browser/google_util.h"
#include "chrome/browser/js_before_unload_handler.h"
#include "chrome/browser/jsmessage_box_handler.h"
@@ -44,7 +45,6 @@
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_manager.h"
-#include "chrome/browser/gears_integration.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/plugin_installer.h"
#include "chrome/browser/plugin_service.h"
@@ -169,7 +169,7 @@ class WebContents::GearsCreateShortcutCallbackFunctor {
explicit GearsCreateShortcutCallbackFunctor(WebContents* contents)
: contents_(contents) {}
- void Run(const GearsShortcutData& shortcut_data, bool success) {
+ void Run(const GearsShortcutData2& shortcut_data, bool success) {
if (contents_)
contents_->OnGearsCreateShortcutDone(shortcut_data, success);
delete this;
@@ -1340,15 +1340,12 @@ void WebContents::OnDidGetApplicationInfo(
if (pending_install_.page_id != page_id)
return; // The user clicked create on a separate page. Ignore this.
-#if defined(OS_WIN)
- // TODO(port): include when gears integration is ported
pending_install_.callback_functor =
new GearsCreateShortcutCallbackFunctor(this);
GearsCreateShortcut(
info, pending_install_.title, pending_install_.url, pending_install_.icon,
NewCallback(pending_install_.callback_functor,
&GearsCreateShortcutCallbackFunctor::Run));
-#endif
}
void WebContents::OnEnterOrSpace() {
@@ -1575,7 +1572,7 @@ void WebContents::UpdateWebPreferences() {
}
void WebContents::OnGearsCreateShortcutDone(
- const GearsShortcutData& shortcut_data, bool success) {
+ const GearsShortcutData2& shortcut_data, bool success) {
NavigationEntry* current_entry = controller()->GetLastCommittedEntry();
bool same_page =
current_entry && pending_install_.page_id == current_entry->page_id();
diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h
index 275f6f3..e93cc0b 100644
--- a/chrome/browser/tab_contents/web_contents.h
+++ b/chrome/browser/tab_contents/web_contents.h
@@ -16,6 +16,7 @@
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/render_view_host_manager.h"
+#include "chrome/common/gears_api.h"
#include "net/base/load_states.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/webpreferences.h"
@@ -28,7 +29,6 @@
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/gears_api.h"
#endif
class AutofillForm;
@@ -461,7 +461,7 @@ class WebContents : public TabContents,
// Called when the user dismisses the shortcut creation dialog. 'success' is
// true if the shortcut was created.
- void OnGearsCreateShortcutDone(const GearsShortcutData& shortcut_data,
+ void OnGearsCreateShortcutDone(const GearsShortcutData2& shortcut_data,
bool success);
// If our controller was restored and the page id is > than the site
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 50e9759..7b16e217 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -290,6 +290,7 @@
844EA08D0F3E0C5000B0EF26 /* debugger_node.cc in Sources */ = {isa = PBXBuildFile; fileRef = 844EA07A0F3E0C1000B0EF26 /* debugger_node.cc */; };
844EA08E0F3E0C5900B0EF26 /* debugger_wrapper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 844EA0820F3E0C1000B0EF26 /* debugger_wrapper.cc */; };
8570EB3F140C07ABF1957F12 /* url_pattern_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A9C335E39D39A7DE087850FC /* url_pattern_unittest.cc */; };
+ 85C8A66BBC97243AF1C11166 /* gears_integration.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8830E9D4839009A6919 /* gears_integration.cc */; };
8CB218DCFAC761AC876C6531 /* ssl_blocking_page.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16ECB0F21451600861FAC /* ssl_blocking_page.cc */; };
8F51B73AAAF1772ECF9BD180 /* url_fetcher.cc in Sources */ = {isa = PBXBuildFile; fileRef = 778D7927798B7E3FAA498D3D /* url_fetcher.cc */; };
9084D27A4F8690E6FD31083B /* session_backend.cc in Sources */ = {isa = PBXBuildFile; fileRef = 35AC9D9A03545594C102C5C1 /* session_backend.cc */; };
@@ -5409,6 +5410,7 @@
E45075C10F1506F2003BE099 /* firefox2_importer.cc in Sources */,
E45075C40F150701003BE099 /* firefox3_importer.cc in Sources */,
E45075C60F15070D003BE099 /* firefox_profile_lock.cc in Sources */,
+ 85C8A66BBC97243AF1C11166 /* gears_integration.cc in Sources */,
4D7BF9990E9D486B009A6919 /* google_url_tracker.cc in Sources */,
4D7BF99E0E9D486F009A6919 /* google_util.cc in Sources */,
C8F5EB819EA38CE9D50AF5B5 /* history.cc in Sources */,
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index a5f2cd4..e356d04 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -508,3 +508,8 @@ InfoBar* LinkInfoBarDelegate::CreateInfoBar() {
NOTIMPLEMENTED();
return NULL;
}
+
+void CPHandleCommand(int command, CPCommandInterface* data,
+ CPBrowsingContext context) {
+ NOTIMPLEMENTED();
+}
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index fdd0d48..d76a1f2 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -56,6 +56,7 @@ class Browser;
class BookmarkService;
class CommandLine;
class ConstrainedWindow;
+class CPCommandInterface;
class DOMUIHost;
class DownloadManager;
class HistoryService;
@@ -720,10 +721,6 @@ class WebApp : public base::RefCountedThreadSafe<WebApp> {
}
};
-class GearsShortcutData {
- public:
-};
-
namespace printing {
class PrintViewManager {
public: