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/api/file_handlers/file_handlers_parser.h" | 21 #include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" |
22 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 22 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "extensions/common/constants.h" | 26 #include "extensions/common/constants.h" |
27 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
28 #include "extensions/common/manifest_handlers/icons_handler.h" | 28 #include "extensions/common/manifest_handlers/icons_handler.h" |
29 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 30 #include "net/base/url_constants.h" |
30 #include "skia/ext/image_operations.h" | 31 #include "skia/ext/image_operations.h" |
31 #include "third_party/skia/include/core/SkBitmap.h" | 32 #include "third_party/skia/include/core/SkBitmap.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/image/image.h" | 34 #include "ui/gfx/image/image.h" |
34 #include "ui/gfx/image/image_family.h" | 35 #include "ui/gfx/image/image_family.h" |
35 #include "ui/gfx/image/image_skia.h" | 36 #include "ui/gfx/image/image_skia.h" |
36 | 37 |
37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
38 #include "ui/gfx/icon_util.h" | 39 #include "ui/gfx/icon_util.h" |
39 #endif | 40 #endif |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 const extensions::Extension* app) { | 430 const extensions::Extension* app) { |
430 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
431 | 432 |
432 GetInfoForApp(app, | 433 GetInfoForApp(app, |
433 profile, | 434 profile, |
434 base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); | 435 base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); |
435 } | 436 } |
436 | 437 |
437 bool IsValidUrl(const GURL& url) { | 438 bool IsValidUrl(const GURL& url) { |
438 static const char* const kValidUrlSchemes[] = { | 439 static const char* const kValidUrlSchemes[] = { |
439 content::kFileScheme, | 440 content::kFileScheme, content::kFileSystemScheme, |
440 content::kFileSystemScheme, | 441 content::kFtpScheme, net::kHttpScheme, |
441 content::kFtpScheme, | 442 net::kHttpsScheme, extensions::kExtensionScheme, |
442 content::kHttpScheme, | |
443 content::kHttpsScheme, | |
444 extensions::kExtensionScheme, | |
445 }; | 443 }; |
446 | 444 |
447 for (size_t i = 0; i < arraysize(kValidUrlSchemes); ++i) { | 445 for (size_t i = 0; i < arraysize(kValidUrlSchemes); ++i) { |
448 if (url.SchemeIs(kValidUrlSchemes[i])) | 446 if (url.SchemeIs(kValidUrlSchemes[i])) |
449 return true; | 447 return true; |
450 } | 448 } |
451 | 449 |
452 return false; | 450 return false; |
453 } | 451 } |
454 | 452 |
(...skipping 16 matching lines...) Expand all Loading... |
471 | 469 |
472 #if defined(OS_LINUX) | 470 #if defined(OS_LINUX) |
473 std::string GetWMClassFromAppName(std::string app_name) { | 471 std::string GetWMClassFromAppName(std::string app_name) { |
474 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 472 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
475 base::TrimString(app_name, "_", &app_name); | 473 base::TrimString(app_name, "_", &app_name); |
476 return app_name; | 474 return app_name; |
477 } | 475 } |
478 #endif | 476 #endif |
479 | 477 |
480 } // namespace web_app | 478 } // namespace web_app |
OLD | NEW |