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

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

Issue 213113005: Remove web_app_ui.[cc|h]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 8 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/web_applications/web_app.h" 5 #include "chrome/browser/web_applications/web_app.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/i18n/file_util_icu.h" 10 #include "base/i18n/file_util_icu.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "chrome/browser/extensions/image_loader.h" 15 #include "chrome/browser/extensions/image_loader.h"
16 #include "chrome/browser/extensions/tab_helper.h"
17 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_version_info.h" 20 #include "chrome/common/chrome_version_info.h"
19 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 21 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
20 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" 22 #include "chrome/common/extensions/manifest_handlers/icons_handler.h"
21 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
22 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
23 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
24 #include "extensions/common/constants.h" 26 #include "extensions/common/constants.h"
25 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 base::string16 file_name = name; 129 base::string16 file_name = name;
128 #else 130 #else
129 std::string file_name = base::UTF16ToUTF8(name); 131 std::string file_name = base::UTF16ToUTF8(name);
130 #endif 132 #endif
131 file_util::ReplaceIllegalCharactersInPath(&file_name, '_'); 133 file_util::ReplaceIllegalCharactersInPath(&file_name, '_');
132 return base::FilePath(file_name); 134 return base::FilePath(file_name);
133 } 135 }
134 136
135 } // namespace internals 137 } // namespace internals
136 138
139 void GetShortcutInfoForTab(content::WebContents* web_contents,
140 ShellIntegration::ShortcutInfo* info) {
141 DCHECK(info); // Must provide a valid info.
142
143 const FaviconTabHelper* favicon_tab_helper =
144 FaviconTabHelper::FromWebContents(web_contents);
145 const extensions::TabHelper* extensions_tab_helper =
146 extensions::TabHelper::FromWebContents(web_contents);
147 const WebApplicationInfo& app_info = extensions_tab_helper->web_app_info();
148
149 info->url = app_info.app_url.is_empty() ? web_contents->GetURL() :
150 app_info.app_url;
151 info->title = app_info.title.empty() ?
152 (web_contents->GetTitle().empty() ? base::UTF8ToUTF16(info->url.spec()) :
153 web_contents->GetTitle()) :
154 app_info.title;
155 info->description = app_info.description;
156 info->favicon.Add(favicon_tab_helper->GetFavicon());
157
158 Profile* profile =
159 Profile::FromBrowserContext(web_contents->GetBrowserContext());
160 info->profile_path = profile->GetPath();
161 }
162
163 #if !defined(OS_WIN)
164 void UpdateShortcutForTabContents(content::WebContents* web_contents) {}
165 #endif
166
137 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( 167 ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile(
138 const extensions::Extension* app, Profile* profile) { 168 const extensions::Extension* app, Profile* profile) {
139 ShellIntegration::ShortcutInfo shortcut_info; 169 ShellIntegration::ShortcutInfo shortcut_info;
140 shortcut_info.extension_id = app->id(); 170 shortcut_info.extension_id = app->id();
141 shortcut_info.is_platform_app = app->is_platform_app(); 171 shortcut_info.is_platform_app = app->is_platform_app();
142 shortcut_info.url = extensions::AppLaunchInfo::GetLaunchWebURL(app); 172 shortcut_info.url = extensions::AppLaunchInfo::GetLaunchWebURL(app);
143 shortcut_info.title = base::UTF8ToUTF16(app->name()); 173 shortcut_info.title = base::UTF8ToUTF16(app->name());
144 shortcut_info.description = base::UTF8ToUTF16(app->description()); 174 shortcut_info.description = base::UTF8ToUTF16(app->description());
145 shortcut_info.extension_path = app->path(); 175 shortcut_info.extension_path = app->path();
146 shortcut_info.profile_path = profile->GetPath(); 176 shortcut_info.profile_path = profile->GetPath();
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 381
352 #if defined(OS_LINUX) 382 #if defined(OS_LINUX)
353 std::string GetWMClassFromAppName(std::string app_name) { 383 std::string GetWMClassFromAppName(std::string app_name) {
354 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); 384 file_util::ReplaceIllegalCharactersInPath(&app_name, '_');
355 base::TrimString(app_name, "_", &app_name); 385 base::TrimString(app_name, "_", &app_name);
356 return app_name; 386 return app_name;
357 } 387 }
358 #endif 388 #endif
359 389
360 } // namespace web_app 390 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app.h ('k') | chrome/browser/web_applications/web_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698