| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/bookmark_app_bubble_view.h" | 5 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 9 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
| 10 #include "chrome/browser/extensions/bookmark_app_helper.h" | 10 #include "chrome/browser/extensions/bookmark_app_helper.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/launch_util.h" | 12 #include "chrome/browser/extensions/launch_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
| 16 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 17 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
| 18 #include "extensions/browser/pref_names.h" | 18 #include "extensions/browser/pref_names.h" |
| 19 #include "extensions/browser/uninstall_reason.h" |
| 19 #include "extensions/common/constants.h" | 20 #include "extensions/common/constants.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/events/keycodes/keyboard_codes.h" | 25 #include "ui/events/keycodes/keyboard_codes.h" |
| 25 #include "ui/views/controls/button/checkbox.h" | 26 #include "ui/views/controls/button/checkbox.h" |
| 26 #include "ui/views/controls/button/label_button.h" | 27 #include "ui/views/controls/button/label_button.h" |
| 27 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
| 28 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 201 |
| 201 void BookmarkAppBubbleView::WindowClosing() { | 202 void BookmarkAppBubbleView::WindowClosing() { |
| 202 // We have to reset |bookmark_app_bubble_| here, not in our destructor, | 203 // We have to reset |bookmark_app_bubble_| here, not in our destructor, |
| 203 // because we'll be destroyed asynchronously and the shown state will be | 204 // because we'll be destroyed asynchronously and the shown state will be |
| 204 // checked before then. | 205 // checked before then. |
| 205 DCHECK_EQ(bookmark_app_bubble_, this); | 206 DCHECK_EQ(bookmark_app_bubble_, this); |
| 206 bookmark_app_bubble_ = NULL; | 207 bookmark_app_bubble_ = NULL; |
| 207 | 208 |
| 208 if (remove_app_) { | 209 if (remove_app_) { |
| 209 GetExtensionService(profile_)->UninstallExtension( | 210 GetExtensionService(profile_)->UninstallExtension( |
| 210 extension_id_, | 211 extension_id_, extensions::UNINSTALL_REASON_INSTALL_CANCELED, NULL); |
| 211 ExtensionService::UNINSTALL_REASON_INSTALL_CANCELED, | |
| 212 NULL); | |
| 213 } else { | 212 } else { |
| 214 ApplyEdits(); | 213 ApplyEdits(); |
| 215 } | 214 } |
| 216 } | 215 } |
| 217 | 216 |
| 218 bool BookmarkAppBubbleView::AcceleratorPressed( | 217 bool BookmarkAppBubbleView::AcceleratorPressed( |
| 219 const ui::Accelerator& accelerator) { | 218 const ui::Accelerator& accelerator) { |
| 220 if (accelerator.key_code() == ui::VKEY_RETURN) { | 219 if (accelerator.key_code() == ui::VKEY_RETURN) { |
| 221 HandleButtonPressed(add_button_); | 220 HandleButtonPressed(add_button_); |
| 222 } | 221 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (extension && base::UTF8ToUTF16(extension->name()) == title_tf_->text()) | 266 if (extension && base::UTF8ToUTF16(extension->name()) == title_tf_->text()) |
| 268 return; | 267 return; |
| 269 | 268 |
| 270 // Reinstall the app with an updated name. | 269 // Reinstall the app with an updated name. |
| 271 WebApplicationInfo install_info(web_app_info_); | 270 WebApplicationInfo install_info(web_app_info_); |
| 272 install_info.title = title_tf_->text(); | 271 install_info.title = title_tf_->text(); |
| 273 | 272 |
| 274 extensions::CreateOrUpdateBookmarkApp(GetExtensionService(profile_), | 273 extensions::CreateOrUpdateBookmarkApp(GetExtensionService(profile_), |
| 275 install_info); | 274 install_info); |
| 276 } | 275 } |
| OLD | NEW |