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

Side by Side Diff: chrome/browser/web_applications/web_app.h

Issue 482003: Get web app icon via FavIconHelper and auto repair/update (Closed)
Patch Set: miranda's review 1 Created 11 years 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_WEB_APPLICATIONS_WEB_APP_H_ 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_
6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ 6 #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "chrome/browser/shell_integration.h" 10 #include "chrome/browser/shell_integration.h"
11 #include "webkit/glue/dom_operations.h"
12
13 class Profile;
14 class TabContents;
11 15
12 namespace web_app { 16 namespace web_app {
13 17
14 // Compute a deterministic name based on the URL. We use this pseudo name 18 // Compute a deterministic name based on the URL. We use this pseudo name
15 // as a key to store window location per application URLs in Browser and 19 // as a key to store window location per application URLs in Browser and
16 // as app id for BrowserWindow, shortcut and jump list. 20 // as app id for BrowserWindow, shortcut and jump list.
17 std::wstring GenerateApplicationNameFromURL(const GURL& url); 21 std::wstring GenerateApplicationNameFromURL(const GURL& url);
18 22
19 // Callback after user dismisses CreateShortcutView. "true" indicates 23 // Callback after user dismisses CreateShortcutView. "true" indicates
20 // shortcut is created successfully. Otherwise, it is false. 24 // shortcut is created successfully. Otherwise, it is false.
21 typedef Callback1<bool>::Type CreateShortcutCallback; 25 typedef Callback1<bool>::Type CreateShortcutCallback;
22 26
23 // Creates a shortcut for web application based on given shortcut data. 27 // Creates a shortcut for web application based on given shortcut data.
24 // |root_dir| is used as root directory for persisted data such as icon. 28 // |root_dir| is used as root directory for persisted data such as icon.
25 // Directory layout is similar to what Gears has, i.e. an web application's 29 // Directory layout is similar to what Gears has, i.e. an web application's
26 // file is stored under "#/host_name/scheme_port", where '#' is the 30 // file is stored under "#/host_name/scheme_port", where '#' is the
27 // |root_dir|. 31 // |root_dir|.
28 void CreateShortcut( 32 void CreateShortcut(
29 const FilePath& data_dir, 33 const FilePath& data_dir,
30 const ShellIntegration::ShortcutInfo& shortcut_info, 34 const ShellIntegration::ShortcutInfo& shortcut_info,
31 CreateShortcutCallback* callback); 35 CreateShortcutCallback* callback);
32 36
33 // Returns true if given url is a valid web app url. 37 // Returns true if given url is a valid web app url.
34 bool IsValidUrl(const GURL& url); 38 bool IsValidUrl(const GURL& url);
35 39
40 // Returns data dir for web apps for given profile.
41 FilePath GetDataDir(Profile* profile);
42
43 // Extracts icons info from web app data. Take only square shaped icons and
44 // sort them from smallest to largest.
45 typedef std::vector<webkit_glue::WebApplicationInfo::IconInfo> IconInfoList;
46 void GetIconsInfo(const webkit_glue::WebApplicationInfo& app_info,
47 IconInfoList* icons);
48
49 // Extracts shortcut info of given TabContents.
50 void GetShortcutInfoForTab(TabContents* tab_contents,
51 ShellIntegration::ShortcutInfo* info);
52
53 // Updates web app shortcut of the TabContents. This function checks and
54 // updates web app icon and shortcuts if needed. For icon, the check is based
55 // on MD5 hash of icon image. For shortcuts, it checks the desktop, start menu
56 // and quick launch (as well as pinned shortcut) for shortcut and only
57 // updates (recreates) them if they exits.
58 void UpdateShortcutForTabContents(TabContents* tab_contents);
59
36 }; // namespace web_app 60 }; // namespace web_app
37 61
38 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ 62 #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/create_application_shortcut_view.cc ('k') | chrome/browser/web_applications/web_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698