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/bookmarks/bookmark_bubble_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
6 | 6 |
7 #include "base/string16.h" | 7 #include "base/string16.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/bookmarks/bookmark_editor.h" | 11 #include "chrome/browser/bookmarks/bookmark_editor.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/bookmarks/bookmark_utils.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/browser/user_metrics.h" | 18 #include "content/browser/user_metrics.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
22 #include "ui/base/keycodes/keyboard_codes.h" | 22 #include "ui/base/keycodes/keyboard_codes.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/views/events/event.h" | 25 #include "ui/views/events/event.h" |
26 #include "ui/views/layout/grid_layout.h" | 26 #include "ui/views/layout/grid_layout.h" |
27 #include "ui/views/layout/layout_constants.h" | 27 #include "ui/views/layout/layout_constants.h" |
28 #include "views/controls/button/text_button.h" | 28 #include "views/controls/button/text_button.h" |
| 29 #include "views/controls/combobox/combobox.h" |
29 #include "views/controls/label.h" | 30 #include "views/controls/label.h" |
30 #include "views/controls/link.h" | 31 #include "views/controls/link.h" |
31 #include "views/controls/textfield/textfield.h" | 32 #include "views/controls/textfield/textfield.h" |
32 #include "views/widget/widget.h" | 33 #include "views/widget/widget.h" |
33 | 34 |
34 using views::ColumnSet; | 35 using views::ColumnSet; |
35 using views::GridLayout; | 36 using views::GridLayout; |
36 | 37 |
37 // Padding between "Title:" and the actual title. | 38 // Padding between "Title:" and the actual title. |
38 static const int kTitlePadding = 4; | 39 static const int kTitlePadding = 4; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) { | 273 void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) { |
273 DCHECK(source == remove_link_); | 274 DCHECK(source == remove_link_); |
274 UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Unstar")); | 275 UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Unstar")); |
275 | 276 |
276 // Set this so we remove the bookmark after the window closes. | 277 // Set this so we remove the bookmark after the window closes. |
277 remove_bookmark_ = true; | 278 remove_bookmark_ = true; |
278 apply_edits_ = false; | 279 apply_edits_ = false; |
279 StartFade(false); | 280 StartFade(false); |
280 } | 281 } |
281 | 282 |
282 void BookmarkBubbleView::ItemChanged(views::Combobox* combobox, | 283 void BookmarkBubbleView::ItemChanged(views::Combobox* combo_box, |
283 int prev_index, | 284 int prev_index, |
284 int new_index) { | 285 int new_index) { |
285 if (new_index + 1 == parent_model_.GetItemCount()) { | 286 if (new_index + 1 == parent_model_.GetItemCount()) { |
286 UserMetrics::RecordAction( | 287 UserMetrics::RecordAction( |
287 UserMetricsAction("BookmarkBubble_EditFromCombobox")); | 288 UserMetricsAction("BookmarkBubble_EditFromCombobox")); |
288 ShowEditor(); | 289 ShowEditor(); |
289 } | 290 } |
290 } | 291 } |
291 | 292 |
292 void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { | 293 void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 const BookmarkNode* new_parent = | 332 const BookmarkNode* new_parent = |
332 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 333 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
333 if (new_parent != node->parent()) { | 334 if (new_parent != node->parent()) { |
334 UserMetrics::RecordAction( | 335 UserMetrics::RecordAction( |
335 UserMetricsAction("BookmarkBubble_ChangeParent")); | 336 UserMetricsAction("BookmarkBubble_ChangeParent")); |
336 model->Move(node, new_parent, new_parent->child_count()); | 337 model->Move(node, new_parent, new_parent->child_count()); |
337 } | 338 } |
338 } | 339 } |
339 } | 340 } |
340 } | 341 } |
OLD | NEW |