OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_GEARS_INTEGRATION_H__ | 5 #ifndef CHROME_BROWSER_GEARS_INTEGRATION_H__ |
6 #define CHROME_BROWSER_GEARS_INTEGRATION_H__ | 6 #define CHROME_BROWSER_GEARS_INTEGRATION_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/common/gears_api.h" | 11 #include "chrome/common/gears_api.h" |
12 #include "gfx/native_widget_types.h" | 12 #include "gfx/native_widget_types.h" |
13 | 13 |
14 // TODO(michaeln): Rework this interface to match how other first class | 14 // TODO(michaeln): Rework this interface to match how other first class |
15 // citizens of chrome are structured, as a GearsService with an accessor | 15 // citizens of chrome are structured, as a GearsService with an accessor |
16 // available via browser.gears_service(). | 16 // available via browser.gears_service(). |
17 | 17 |
18 class CPCommandInterface; | 18 class CPCommandInterface; |
19 class GURL; | 19 class GURL; |
20 class SkBitmap; | 20 class SkBitmap; |
21 namespace webkit_glue { | |
22 struct WebApplicationInfo; | 21 struct WebApplicationInfo; |
23 } | |
24 | 22 |
25 // We use this in place of GearsShortcutData so we can keep browser-specific | 23 // We use this in place of GearsShortcutData so we can keep browser-specific |
26 // data on the structure. | 24 // data on the structure. |
27 struct GearsCreateShortcutData : public GearsShortcutData2 { | 25 struct GearsCreateShortcutData : public GearsShortcutData2 { |
28 CPCommandInterface* command_interface; | 26 CPCommandInterface* command_interface; |
29 }; | 27 }; |
30 | 28 |
31 // Called when the Gears Settings button is pressed. |parent_wnd| is the | 29 // Called when the Gears Settings button is pressed. |parent_wnd| is the |
32 // window the Gears Settings dialog should be parented to. | 30 // window the Gears Settings dialog should be parented to. |
33 void GearsSettingsPressed(gfx::NativeWindow parent_wnd); | 31 void GearsSettingsPressed(gfx::NativeWindow parent_wnd); |
34 | 32 |
35 // Calls into the Gears API to create a shortcut with the given parameters. | 33 // Calls into the Gears API to create a shortcut with the given parameters. |
36 // 'app_info' is the optional information provided by the page. If any info is | 34 // 'app_info' is the optional information provided by the page. If any info is |
37 // missing, we fallback to the given fallback params. 'fallback_icon' must be a | 35 // missing, we fallback to the given fallback params. 'fallback_icon' must be a |
38 // 16x16 favicon. 'callback' will be called with a value indicating whether the | 36 // 16x16 favicon. 'callback' will be called with a value indicating whether the |
39 // shortcut has been created successfully. | 37 // shortcut has been created successfully. |
40 typedef Callback2<const GearsShortcutData2&, bool>::Type | 38 typedef Callback2<const GearsShortcutData2&, bool>::Type |
41 GearsCreateShortcutCallback; | 39 GearsCreateShortcutCallback; |
42 | 40 |
43 void GearsCreateShortcut( | 41 void GearsCreateShortcut(const WebApplicationInfo& app_info, |
44 const webkit_glue::WebApplicationInfo& app_info, | 42 const string16& fallback_name, |
45 const string16& fallback_name, | 43 const GURL& fallback_url, |
46 const GURL& fallback_url, | 44 const SkBitmap& fallback_icon, |
47 const SkBitmap& fallback_icon, | 45 GearsCreateShortcutCallback* callback); |
48 GearsCreateShortcutCallback* callback); | |
49 | 46 |
50 // Call into Gears to query the list of shortcuts. Results will be returned | 47 // Call into Gears to query the list of shortcuts. Results will be returned |
51 // asynchronously via the callback. The callback's arguments will be NULL | 48 // asynchronously via the callback. The callback's arguments will be NULL |
52 // if there was an error. | 49 // if there was an error. |
53 typedef Callback1<GearsShortcutList*>::Type GearsQueryShortcutsCallback; | 50 typedef Callback1<GearsShortcutList*>::Type GearsQueryShortcutsCallback; |
54 | 51 |
55 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback); | 52 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback); |
56 | 53 |
57 // When the Gears shortcut database is modified, the main thread is notified | 54 // When the Gears shortcut database is modified, the main thread is notified |
58 // via the NotificationService, NOTIFY_WEB_APP_INSTALL_CHANGED. | 55 // via the NotificationService, NOTIFY_WEB_APP_INSTALL_CHANGED. |
59 | 56 |
60 #endif // CHROME_BROWSER_GEARS_INTEGRATION_H__ | 57 #endif // CHROME_BROWSER_GEARS_INTEGRATION_H__ |
OLD | NEW |