| 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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
| 13 #include "chrome/browser/extensions/extension_tab_helper.h" | 13 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 14 #include "chrome/browser/favicon/favicon_tab_helper.h" | 14 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 18 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 19 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 19 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 20 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
| 22 #include "chrome/common/extensions/extension_resource.h" | 22 #include "chrome/common/extensions/extension_resource.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 #include "grit/locale_settings.h" | 27 #include "grit/locale_settings.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8); | 193 inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8); |
| 194 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), | 194 canvas->sk_canvas()->drawRoundRect(inner_rect, SkDoubleToScalar(1.5), |
| 195 SkDoubleToScalar(1.5), inner_paint); | 195 SkDoubleToScalar(1.5), inner_paint); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace | 198 } // namespace |
| 199 | 199 |
| 200 namespace browser { | 200 namespace browser { |
| 201 | 201 |
| 202 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, | 202 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 203 TabContentsWrapper* tab_contents) { | 203 TabContents* tab_contents) { |
| 204 views::Widget::CreateWindowWithParent( | 204 views::Widget::CreateWindowWithParent( |
| 205 new CreateUrlApplicationShortcutView(tab_contents), | 205 new CreateUrlApplicationShortcutView(tab_contents), |
| 206 parent_window)->Show(); | 206 parent_window)->Show(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, | 209 void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, |
| 210 Profile* profile, | 210 Profile* profile, |
| 211 const extensions::Extension* app) { | 211 const extensions::Extension* app) { |
| 212 views::Widget::CreateWindowWithParent( | 212 views::Widget::CreateWindowWithParent( |
| 213 new CreateChromeApplicationShortcutView(profile, app), | 213 new CreateChromeApplicationShortcutView(profile, app), |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 menu_check_box_->checked() ? true : false); | 405 menu_check_box_->checked() ? true : false); |
| 406 else if (sender == quick_launch_check_box_) | 406 else if (sender == quick_launch_check_box_) |
| 407 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInQuickLaunchBar, | 407 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInQuickLaunchBar, |
| 408 quick_launch_check_box_->checked() ? true : false); | 408 quick_launch_check_box_->checked() ? true : false); |
| 409 | 409 |
| 410 // When no checkbox is checked we should not have the action button enabled. | 410 // When no checkbox is checked we should not have the action button enabled. |
| 411 GetDialogClientView()->UpdateDialogButtons(); | 411 GetDialogClientView()->UpdateDialogButtons(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( | 414 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
| 415 TabContentsWrapper* tab_contents) | 415 TabContents* tab_contents) |
| 416 : CreateApplicationShortcutView(tab_contents->profile()), | 416 : CreateApplicationShortcutView(tab_contents->profile()), |
| 417 tab_contents_(tab_contents), | 417 tab_contents_(tab_contents), |
| 418 pending_download_(NULL) { | 418 pending_download_(NULL) { |
| 419 | 419 |
| 420 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); | 420 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); |
| 421 const WebApplicationInfo& app_info = | 421 const WebApplicationInfo& app_info = |
| 422 tab_contents_->extension_tab_helper()->web_app_info(); | 422 tab_contents_->extension_tab_helper()->web_app_info(); |
| 423 if (!app_info.icons.empty()) { | 423 if (!app_info.icons.empty()) { |
| 424 web_app::GetIconsInfo(app_info, &unprocessed_icons_); | 424 web_app::GetIconsInfo(app_info, &unprocessed_icons_); |
| 425 FetchIcon(); | 425 FetchIcon(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 if (image.IsEmpty()) { | 534 if (image.IsEmpty()) { |
| 535 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance(). | 535 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance(). |
| 536 GetImageNamed(IDR_APP_DEFAULT_ICON); | 536 GetImageNamed(IDR_APP_DEFAULT_ICON); |
| 537 } else { | 537 } else { |
| 538 shortcut_info_.favicon = image; | 538 shortcut_info_.favicon = image; |
| 539 } | 539 } |
| 540 | 540 |
| 541 CHECK(app_info_); | 541 CHECK(app_info_); |
| 542 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 542 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
| 543 } | 543 } |
| OLD | NEW |