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" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, | 202 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, |
203 TabContentsWrapper* tab_contents) { | 203 TabContentsWrapper* 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 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), |
214 parent_window)->Show(); | 214 parent_window)->Show(); |
215 } | 215 } |
216 | 216 |
217 } // namespace browser | 217 } // namespace browser |
218 | 218 |
219 class CreateUrlApplicationShortcutView::IconDownloadCallbackFunctor { | 219 class CreateUrlApplicationShortcutView::IconDownloadCallbackFunctor { |
220 public: | 220 public: |
221 explicit IconDownloadCallbackFunctor(CreateUrlApplicationShortcutView* owner) | 221 explicit IconDownloadCallbackFunctor(CreateUrlApplicationShortcutView* owner) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (!errored && !image.isNull()) { | 475 if (!errored && !image.isNull()) { |
476 shortcut_info_.favicon = gfx::Image(image); | 476 shortcut_info_.favicon = gfx::Image(image); |
477 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 477 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
478 } else { | 478 } else { |
479 FetchIcon(); | 479 FetchIcon(); |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 CreateChromeApplicationShortcutView::CreateChromeApplicationShortcutView( | 483 CreateChromeApplicationShortcutView::CreateChromeApplicationShortcutView( |
484 Profile* profile, | 484 Profile* profile, |
485 const Extension* app) : | 485 const extensions::Extension* app) : |
486 CreateApplicationShortcutView(profile), | 486 CreateApplicationShortcutView(profile), |
487 app_(app), | 487 app_(app), |
488 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { | 488 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { |
489 shortcut_info_.extension_id = app_->id(); | 489 shortcut_info_.extension_id = app_->id(); |
490 shortcut_info_.url = GURL(app_->launch_web_url()); | 490 shortcut_info_.url = GURL(app_->launch_web_url()); |
491 shortcut_info_.title = UTF8ToUTF16(app_->name()); | 491 shortcut_info_.title = UTF8ToUTF16(app_->name()); |
492 shortcut_info_.description = UTF8ToUTF16(app_->description()); | 492 shortcut_info_.description = UTF8ToUTF16(app_->description()); |
493 shortcut_info_.is_platform_app = app_->is_platform_app(); | 493 shortcut_info_.is_platform_app = app_->is_platform_app(); |
494 shortcut_info_.extension_path = app_->path(); | 494 shortcut_info_.extension_path = app_->path(); |
495 | 495 |
(...skipping 38 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 |