OLD | NEW |
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" | 16 #include "chrome/browser/extensions/tab_helper.h" |
17 #include "chrome/browser/favicon/favicon_tab_helper.h" | 17 #include "chrome/browser/favicon/favicon_tab_helper.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
21 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 21 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/common/url_constants.h" | |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
25 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
26 #include "extensions/common/extension.h" | 25 #include "extensions/common/extension.h" |
27 #include "extensions/common/manifest_handlers/icons_handler.h" | 26 #include "extensions/common/manifest_handlers/icons_handler.h" |
28 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
29 #include "skia/ext/image_operations.h" | 28 #include "skia/ext/image_operations.h" |
30 #include "third_party/skia/include/core/SkBitmap.h" | 29 #include "third_party/skia/include/core/SkBitmap.h" |
31 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
33 #include "ui/gfx/image/image_family.h" | 32 #include "ui/gfx/image/image_family.h" |
34 #include "ui/gfx/image/image_skia.h" | 33 #include "ui/gfx/image/image_skia.h" |
| 34 #include "url/url_constants.h" |
35 | 35 |
36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
37 #include "ui/gfx/icon_util.h" | 37 #include "ui/gfx/icon_util.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 typedef base::Callback<void(const web_app::ShortcutInfo&, | 44 typedef base::Callback<void(const web_app::ShortcutInfo&, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 const extensions::Extension* app) { | 396 const extensions::Extension* app) { |
397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
398 | 398 |
399 GetInfoForApp(app, | 399 GetInfoForApp(app, |
400 profile, | 400 profile, |
401 base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); | 401 base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); |
402 } | 402 } |
403 | 403 |
404 bool IsValidUrl(const GURL& url) { | 404 bool IsValidUrl(const GURL& url) { |
405 static const char* const kValidUrlSchemes[] = { | 405 static const char* const kValidUrlSchemes[] = { |
406 content::kFileScheme, | 406 url::kFileScheme, |
407 content::kFileSystemScheme, | 407 url::kFileSystemScheme, |
408 content::kFtpScheme, | 408 url::kFtpScheme, |
409 url::kHttpScheme, | 409 url::kHttpScheme, |
410 url::kHttpsScheme, | 410 url::kHttpsScheme, |
411 extensions::kExtensionScheme, | 411 extensions::kExtensionScheme, |
412 }; | 412 }; |
413 | 413 |
414 for (size_t i = 0; i < arraysize(kValidUrlSchemes); ++i) { | 414 for (size_t i = 0; i < arraysize(kValidUrlSchemes); ++i) { |
415 if (url.SchemeIs(kValidUrlSchemes[i])) | 415 if (url.SchemeIs(kValidUrlSchemes[i])) |
416 return true; | 416 return true; |
417 } | 417 } |
418 | 418 |
(...skipping 19 matching lines...) Expand all Loading... |
438 | 438 |
439 #if defined(OS_LINUX) | 439 #if defined(OS_LINUX) |
440 std::string GetWMClassFromAppName(std::string app_name) { | 440 std::string GetWMClassFromAppName(std::string app_name) { |
441 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 441 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
442 base::TrimString(app_name, "_", &app_name); | 442 base::TrimString(app_name, "_", &app_name); |
443 return app_name; | 443 return app_name; |
444 } | 444 } |
445 #endif | 445 #endif |
446 | 446 |
447 } // namespace web_app | 447 } // namespace web_app |
OLD | NEW |