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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
15 #include "chrome/browser/favicon/favicon_util.h" | 15 #include "chrome/browser/favicon/favicon_util.h" |
16 #include "chrome/browser/history/select_favicon_frames.h" | 16 #include "chrome/browser/history/select_favicon_frames.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 20 #include "chrome/browser/ui/browser_finder.h" |
21 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 21 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
23 #include "chrome/common/chrome_constants.h" | 23 #include "chrome/common/chrome_constants.h" |
24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| 30 #include "grit/chromium_strings.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "grit/locale_settings.h" | 32 #include "grit/locale_settings.h" |
32 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
33 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
34 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
35 #include "skia/ext/image_operations.h" | 36 #include "skia/ext/image_operations.h" |
36 #include "third_party/skia/include/core/SkBitmap.h" | 37 #include "third_party/skia/include/core/SkBitmap.h" |
37 #include "third_party/skia/include/core/SkPaint.h" | 38 #include "third_party/skia/include/core/SkPaint.h" |
38 #include "third_party/skia/include/core/SkRect.h" | 39 #include "third_party/skia/include/core/SkRect.h" |
39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 371 } |
371 | 372 |
372 bool CreateApplicationShortcutView::Accept() { | 373 bool CreateApplicationShortcutView::Accept() { |
373 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) | 374 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) |
374 return false; | 375 return false; |
375 | 376 |
376 ShellIntegration::ShortcutLocations creation_locations; | 377 ShellIntegration::ShortcutLocations creation_locations; |
377 creation_locations.on_desktop = desktop_check_box_->checked(); | 378 creation_locations.on_desktop = desktop_check_box_->checked(); |
378 creation_locations.in_applications_menu = menu_check_box_ == NULL ? false : | 379 creation_locations.in_applications_menu = menu_check_box_ == NULL ? false : |
379 menu_check_box_->checked(); | 380 menu_check_box_->checked(); |
| 381 creation_locations.applications_menu_subdir = |
| 382 l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME); |
380 | 383 |
381 #if defined(OS_WIN) | 384 #if defined(OS_WIN) |
382 creation_locations.in_quick_launch_bar = quick_launch_check_box_ == NULL ? | 385 creation_locations.in_quick_launch_bar = quick_launch_check_box_ == NULL ? |
383 NULL : quick_launch_check_box_->checked(); | 386 NULL : quick_launch_check_box_->checked(); |
384 #elif defined(OS_POSIX) | 387 #elif defined(OS_POSIX) |
385 // Create shortcut in Mac dock or as Linux (gnome/kde) application launcher | 388 // Create shortcut in Mac dock or as Linux (gnome/kde) application launcher |
386 // are not implemented yet. | 389 // are not implemented yet. |
387 creation_locations.in_quick_launch_bar = false; | 390 creation_locations.in_quick_launch_bar = false; |
388 #endif | 391 #endif |
389 | 392 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} | 525 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |
523 | 526 |
524 // Called when the app's ShortcutInfo (with icon) is loaded. | 527 // Called when the app's ShortcutInfo (with icon) is loaded. |
525 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( | 528 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( |
526 const ShellIntegration::ShortcutInfo& shortcut_info) { | 529 const ShellIntegration::ShortcutInfo& shortcut_info) { |
527 shortcut_info_ = shortcut_info; | 530 shortcut_info_ = shortcut_info; |
528 | 531 |
529 CHECK(app_info_); | 532 CHECK(app_info_); |
530 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 533 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
531 } | 534 } |
OLD | NEW |