| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 13 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 14 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/extension_resource.h" | 17 #include "chrome/common/extensions/extension_resource.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/browser/tab_contents/tab_contents_delegate.h" | 20 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 410 } |
| 410 | 411 |
| 411 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( | 412 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
| 412 TabContentsWrapper* tab_contents) | 413 TabContentsWrapper* tab_contents) |
| 413 : CreateApplicationShortcutView(tab_contents->profile()), | 414 : CreateApplicationShortcutView(tab_contents->profile()), |
| 414 tab_contents_(tab_contents), | 415 tab_contents_(tab_contents), |
| 415 pending_download_(NULL) { | 416 pending_download_(NULL) { |
| 416 | 417 |
| 417 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); | 418 web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); |
| 418 const WebApplicationInfo& app_info = | 419 const WebApplicationInfo& app_info = |
| 419 tab_contents_->tab_contents()->web_app_info(); | 420 tab_contents_->extension_tab_helper()->web_app_info(); |
| 420 if (!app_info.icons.empty()) { | 421 if (!app_info.icons.empty()) { |
| 421 web_app::GetIconsInfo(app_info, &unprocessed_icons_); | 422 web_app::GetIconsInfo(app_info, &unprocessed_icons_); |
| 422 FetchIcon(); | 423 FetchIcon(); |
| 423 } | 424 } |
| 424 | 425 |
| 425 InitControls(); | 426 InitControls(); |
| 426 } | 427 } |
| 427 | 428 |
| 428 CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() { | 429 CreateUrlApplicationShortcutView::~CreateUrlApplicationShortcutView() { |
| 429 if (pending_download_) | 430 if (pending_download_) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void CreateChromeApplicationShortcutView::OnImageLoaded( | 519 void CreateChromeApplicationShortcutView::OnImageLoaded( |
| 519 SkBitmap* image, const ExtensionResource& resource, int index) { | 520 SkBitmap* image, const ExtensionResource& resource, int index) { |
| 520 if (image->isNull()) { | 521 if (image->isNull()) { |
| 521 NOTREACHED() << "Corrupt image in profile?"; | 522 NOTREACHED() << "Corrupt image in profile?"; |
| 522 return; | 523 return; |
| 523 } | 524 } |
| 524 shortcut_info_.favicon = *image; | 525 shortcut_info_.favicon = *image; |
| 525 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 526 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
| 526 } | 527 } |
| 527 | 528 |
| OLD | NEW |