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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 views::Checkbox* CreateApplicationShortcutView::AddCheckbox( | 393 views::Checkbox* CreateApplicationShortcutView::AddCheckbox( |
394 const string16& text, bool checked) { | 394 const string16& text, bool checked) { |
395 views::Checkbox* checkbox = new views::Checkbox(text); | 395 views::Checkbox* checkbox = new views::Checkbox(text); |
396 checkbox->SetChecked(checked); | 396 checkbox->SetChecked(checked); |
397 checkbox->set_listener(this); | 397 checkbox->set_listener(this); |
398 return checkbox; | 398 return checkbox; |
399 } | 399 } |
400 | 400 |
401 void CreateApplicationShortcutView::ButtonPressed(views::Button* sender, | 401 void CreateApplicationShortcutView::ButtonPressed(views::Button* sender, |
402 const ui::Event& event) { | 402 const ui::Event& event) { |
403 if (sender == desktop_check_box_) | 403 if (sender == desktop_check_box_) { |
404 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateOnDesktop, | 404 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateOnDesktop, |
405 desktop_check_box_->checked() ? true : false); | 405 desktop_check_box_->checked()); |
406 else if (sender == menu_check_box_) | 406 } else if (sender == menu_check_box_) { |
407 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInAppsMenu, | 407 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInAppsMenu, |
408 menu_check_box_->checked() ? true : false); | 408 menu_check_box_->checked()); |
409 else if (sender == quick_launch_check_box_) | 409 } else if (sender == quick_launch_check_box_) { |
410 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInQuickLaunchBar, | 410 profile_->GetPrefs()->SetBoolean(prefs::kWebAppCreateInQuickLaunchBar, |
411 quick_launch_check_box_->checked() ? true : false); | 411 quick_launch_check_box_->checked()); |
| 412 } |
412 | 413 |
413 // When no checkbox is checked we should not have the action button enabled. | 414 // When no checkbox is checked we should not have the action button enabled. |
414 GetDialogClientView()->UpdateDialogButtons(); | 415 GetDialogClientView()->UpdateDialogButtons(); |
415 } | 416 } |
416 | 417 |
417 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( | 418 CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( |
418 TabContents* tab_contents) | 419 TabContents* tab_contents) |
419 : CreateApplicationShortcutView(tab_contents->profile()), | 420 : CreateApplicationShortcutView(tab_contents->profile()), |
420 tab_contents_(tab_contents), | 421 tab_contents_(tab_contents), |
421 pending_download_(NULL) { | 422 pending_download_(NULL) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (image.IsEmpty()) { | 540 if (image.IsEmpty()) { |
540 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance(). | 541 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance(). |
541 GetImageNamed(IDR_APP_DEFAULT_ICON); | 542 GetImageNamed(IDR_APP_DEFAULT_ICON); |
542 } else { | 543 } else { |
543 shortcut_info_.favicon = image; | 544 shortcut_info_.favicon = image; |
544 } | 545 } |
545 | 546 |
546 CHECK(app_info_); | 547 CHECK(app_info_); |
547 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 548 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
548 } | 549 } |
OLD | NEW |