| 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/views/constrained_window_views.h" |
| 21 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 22 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 23 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.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 "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
| 30 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), | 222 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), |
| 222 SkDoubleToScalar(1.5), inner_paint); | 223 SkDoubleToScalar(1.5), inner_paint); |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace | 226 } // namespace |
| 226 | 227 |
| 227 namespace chrome { | 228 namespace chrome { |
| 228 | 229 |
| 229 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, | 230 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 230 content::WebContents* web_contents) { | 231 content::WebContents* web_contents) { |
| 231 views::DialogDelegate::CreateDialogWidget( | 232 CreateBrowserModalDialogViews( |
| 232 new CreateUrlApplicationShortcutView(web_contents), | 233 new CreateUrlApplicationShortcutView(web_contents), |
| 233 NULL, parent_window)->Show(); | 234 parent_window)->Show(); |
| 234 } | 235 } |
| 235 | 236 |
| 236 void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, | 237 void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 237 Profile* profile, | 238 Profile* profile, |
| 238 const extensions::Extension* app) { | 239 const extensions::Extension* app) { |
| 239 views::DialogDelegate::CreateDialogWidget( | 240 CreateBrowserModalDialogViews( |
| 240 new CreateChromeApplicationShortcutView(profile, app), | 241 new CreateChromeApplicationShortcutView(profile, app), |
| 241 NULL, parent_window)->Show(); | 242 parent_window)->Show(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace chrome | 245 } // namespace chrome |
| 245 | 246 |
| 246 CreateApplicationShortcutView::CreateApplicationShortcutView(Profile* profile) | 247 CreateApplicationShortcutView::CreateApplicationShortcutView(Profile* profile) |
| 247 : profile_(profile), | 248 : profile_(profile), |
| 248 app_info_(NULL), | 249 app_info_(NULL), |
| 249 create_shortcuts_label_(NULL), | 250 create_shortcuts_label_(NULL), |
| 250 desktop_check_box_(NULL), | 251 desktop_check_box_(NULL), |
| 251 menu_check_box_(NULL), | 252 menu_check_box_(NULL), |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} | 532 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |
| 532 | 533 |
| 533 // Called when the app's ShortcutInfo (with icon) is loaded. | 534 // Called when the app's ShortcutInfo (with icon) is loaded. |
| 534 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( | 535 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( |
| 535 const ShellIntegration::ShortcutInfo& shortcut_info) { | 536 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 536 shortcut_info_ = shortcut_info; | 537 shortcut_info_ = shortcut_info; |
| 537 | 538 |
| 538 CHECK(app_info_); | 539 CHECK(app_info_); |
| 539 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 540 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
| 540 } | 541 } |
| OLD | NEW |