| 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_confirmation_view.h" | 5 #include "chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 13 #include "components/constrained_window/constrained_window_views.h" | 14 #include "components/constrained_window/constrained_window_views.h" |
| 14 #include "components/strings/grit/components_strings.h" | 15 #include "components/strings/grit/components_strings.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "extensions/common/constants.h" | 17 #include "extensions/common/constants.h" |
| 17 #include "ui/accessibility/ax_node_data.h" | 18 #include "ui/accessibility/ax_node_data.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/image/image_skia.h" | 21 #include "ui/gfx/image/image_skia.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 0, layout_provider->GetDistanceMetric(DISTANCE_CONTROL_LIST_VERTICAL)); | 110 0, layout_provider->GetDistanceMetric(DISTANCE_CONTROL_LIST_VERTICAL)); |
| 110 | 111 |
| 111 open_as_window_checkbox_ = new views::Checkbox( | 112 open_as_window_checkbox_ = new views::Checkbox( |
| 112 l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_WINDOW)); | 113 l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_WINDOW)); |
| 113 open_as_window_checkbox_->SetChecked(web_app_info_.open_as_window); | 114 open_as_window_checkbox_->SetChecked(web_app_info_.open_as_window); |
| 114 layout->StartRow(0, column_set_id); | 115 layout->StartRow(0, column_set_id); |
| 115 layout->SkipColumns(1); | 116 layout->SkipColumns(1); |
| 116 layout->AddView(open_as_window_checkbox_); | 117 layout->AddView(open_as_window_checkbox_); |
| 117 | 118 |
| 118 title_tf_->SelectAll(true); | 119 title_tf_->SelectAll(true); |
| 120 chrome::RecordDialogCreation( |
| 121 chrome::DialogIdentifier::BOOKMARK_APP_CONFIRMATION); |
| 119 } | 122 } |
| 120 | 123 |
| 121 views::View* BookmarkAppConfirmationView::GetInitiallyFocusedView() { | 124 views::View* BookmarkAppConfirmationView::GetInitiallyFocusedView() { |
| 122 return title_tf_; | 125 return title_tf_; |
| 123 } | 126 } |
| 124 | 127 |
| 125 ui::ModalType BookmarkAppConfirmationView::GetModalType() const { | 128 ui::ModalType BookmarkAppConfirmationView::GetModalType() const { |
| 126 return ui::MODAL_TYPE_WINDOW; | 129 return ui::MODAL_TYPE_WINDOW; |
| 127 } | 130 } |
| 128 | 131 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 const base::string16& new_contents) { | 177 const base::string16& new_contents) { |
| 175 DCHECK_EQ(title_tf_, sender); | 178 DCHECK_EQ(title_tf_, sender); |
| 176 GetDialogClientView()->UpdateDialogButtons(); | 179 GetDialogClientView()->UpdateDialogButtons(); |
| 177 } | 180 } |
| 178 | 181 |
| 179 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const { | 182 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const { |
| 180 base::string16 title(title_tf_->text()); | 183 base::string16 title(title_tf_->text()); |
| 181 base::TrimWhitespace(title, base::TRIM_ALL, &title); | 184 base::TrimWhitespace(title, base::TRIM_ALL, &title); |
| 182 return title; | 185 return title; |
| 183 } | 186 } |
| OLD | NEW |