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/ui/views/create_application_shortcut_view.h" | 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
15 #include "chrome/browser/extensions/tab_helper.h" | 15 #include "chrome/browser/extensions/tab_helper.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/views/constrained_window_views.h" | 20 #include "chrome/browser/ui/views/constrained_window_views.h" |
21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 21 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
22 #include "chrome/browser/web_applications/web_app.h" | 22 #include "chrome/browser/web_applications/web_app.h" |
23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/generated_resources.h" |
25 #include "components/favicon_base/select_favicon_frames.h" | 26 #include "components/favicon_base/select_favicon_frames.h" |
26 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/render_widget_host_view.h" | 28 #include "content/public/browser/render_widget_host_view.h" |
28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
29 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
30 #include "grit/generated_resources.h" | |
31 #include "grit/locale_settings.h" | 31 #include "grit/locale_settings.h" |
32 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
33 #include "net/base/load_flags.h" | 33 #include "net/base/load_flags.h" |
34 #include "net/url_request/url_request.h" | 34 #include "net/url_request/url_request.h" |
35 #include "skia/ext/image_operations.h" | 35 #include "skia/ext/image_operations.h" |
36 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
37 #include "third_party/skia/include/core/SkPaint.h" | 37 #include "third_party/skia/include/core/SkPaint.h" |
38 #include "third_party/skia/include/core/SkRect.h" | 38 #include "third_party/skia/include/core/SkRect.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/layout.h" | 40 #include "ui/base/layout.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 GetDialogClientView()->UpdateDialogButtons(); | 424 GetDialogClientView()->UpdateDialogButtons(); |
425 } | 425 } |
426 | 426 |
427 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( | 427 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
428 content::WebContents* web_contents) | 428 content::WebContents* web_contents) |
429 : CreateApplicationShortcutView( | 429 : CreateApplicationShortcutView( |
430 Profile::FromBrowserContext(web_contents->GetBrowserContext())), | 430 Profile::FromBrowserContext(web_contents->GetBrowserContext())), |
431 web_contents_(web_contents), | 431 web_contents_(web_contents), |
432 pending_download_id_(-1), | 432 pending_download_id_(-1), |
433 weak_ptr_factory_(this) { | 433 weak_ptr_factory_(this) { |
434 | |
435 web_app::GetShortcutInfoForTab(web_contents_, &shortcut_info_); | 434 web_app::GetShortcutInfoForTab(web_contents_, &shortcut_info_); |
436 const WebApplicationInfo& app_info = | 435 const WebApplicationInfo& app_info = |
437 extensions::TabHelper::FromWebContents(web_contents_)->web_app_info(); | 436 extensions::TabHelper::FromWebContents(web_contents_)->web_app_info(); |
438 if (!app_info.icons.empty()) { | 437 if (!app_info.icons.empty()) { |
439 web_app::GetIconsInfo(app_info, &unprocessed_icons_); | 438 web_app::GetIconsInfo(app_info, &unprocessed_icons_); |
440 FetchIcon(); | 439 FetchIcon(); |
441 } | 440 } |
442 | 441 |
443 // Create URL app shortcuts in the top-level menu. | 442 // Create URL app shortcuts in the top-level menu. |
444 create_in_chrome_apps_subdir_ = false; | 443 create_in_chrome_apps_subdir_ = false; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 close_callback_.Run(false); | 540 close_callback_.Run(false); |
542 return CreateApplicationShortcutView::Cancel(); | 541 return CreateApplicationShortcutView::Cancel(); |
543 } | 542 } |
544 | 543 |
545 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( | 544 void CreateChromeApplicationShortcutView::OnAppInfoLoaded( |
546 const web_app::ShortcutInfo& shortcut_info, | 545 const web_app::ShortcutInfo& shortcut_info, |
547 const extensions::FileHandlersInfo& file_handlers_info) { | 546 const extensions::FileHandlersInfo& file_handlers_info) { |
548 shortcut_info_ = shortcut_info; | 547 shortcut_info_ = shortcut_info; |
549 file_handlers_info_ = file_handlers_info; | 548 file_handlers_info_ = file_handlers_info; |
550 } | 549 } |
OLD | NEW |