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/bookmark_bubble_view.h" | 5 #include "chrome/browser/ui/views/bookmark_bubble_view.h" |
6 | 6 |
7 #include "app/keyboard_codes.h" | |
8 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
10 #include "base/string16.h" | 9 #include "base/string16.h" |
11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/bookmarks/bookmark_editor.h" | 13 #include "chrome/browser/bookmarks/bookmark_editor.h" |
15 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
16 #include "chrome/browser/bookmarks/bookmark_utils.h" | 15 #include "chrome/browser/bookmarks/bookmark_utils.h" |
17 #include "chrome/browser/metrics/user_metrics.h" | 16 #include "chrome/browser/metrics/user_metrics.h" |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/views/info_bubble.h" | 18 #include "chrome/browser/ui/views/info_bubble.h" |
20 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
21 #include "gfx/canvas.h" | 20 #include "gfx/canvas.h" |
22 #include "gfx/color_utils.h" | 21 #include "gfx/color_utils.h" |
23 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
24 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 24 #include "ui/base/keycodes/keyboard_codes.h" |
25 #include "views/event.h" | 25 #include "views/event.h" |
26 #include "views/standard_layout.h" | 26 #include "views/standard_layout.h" |
27 #include "views/controls/button/native_button.h" | 27 #include "views/controls/button/native_button.h" |
28 #include "views/controls/textfield/textfield.h" | 28 #include "views/controls/textfield/textfield.h" |
29 #include "views/focus/focus_manager.h" | 29 #include "views/focus/focus_manager.h" |
30 #include "views/window/client_view.h" | 30 #include "views/window/client_view.h" |
31 #include "views/window/window.h" | 31 #include "views/window/window.h" |
32 | 32 |
33 using views::Combobox; | 33 using views::Combobox; |
34 using views::ColumnSet; | 34 using views::ColumnSet; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous, | 133 void BookmarkBubbleView::DidChangeBounds(const gfx::Rect& previous, |
134 const gfx::Rect& current) { | 134 const gfx::Rect& current) { |
135 Layout(); | 135 Layout(); |
136 } | 136 } |
137 | 137 |
138 void BookmarkBubbleView::BubbleShown() { | 138 void BookmarkBubbleView::BubbleShown() { |
139 DCHECK(GetWidget()); | 139 DCHECK(GetWidget()); |
140 GetFocusManager()->RegisterAccelerator( | 140 GetFocusManager()->RegisterAccelerator( |
141 views::Accelerator(app::VKEY_RETURN, false, false, false), this); | 141 views::Accelerator(ui::VKEY_RETURN, false, false, false), this); |
142 | 142 |
143 title_tf_->RequestFocus(); | 143 title_tf_->RequestFocus(); |
144 title_tf_->SelectAll(); | 144 title_tf_->SelectAll(); |
145 } | 145 } |
146 | 146 |
147 bool BookmarkBubbleView::AcceleratorPressed( | 147 bool BookmarkBubbleView::AcceleratorPressed( |
148 const views::Accelerator& accelerator) { | 148 const views::Accelerator& accelerator) { |
149 if (accelerator.GetKeyCode() != app::VKEY_RETURN) | 149 if (accelerator.GetKeyCode() != ui::VKEY_RETURN) |
150 return false; | 150 return false; |
151 | 151 |
152 if (edit_button_->HasFocus()) | 152 if (edit_button_->HasFocus()) |
153 HandleButtonPressed(edit_button_); | 153 HandleButtonPressed(edit_button_); |
154 else | 154 else |
155 HandleButtonPressed(close_button_); | 155 HandleButtonPressed(close_button_); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 void BookmarkBubbleView::ViewHierarchyChanged(bool is_add, View* parent, | 159 void BookmarkBubbleView::ViewHierarchyChanged(bool is_add, View* parent, |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 const BookmarkNode* new_parent = | 415 const BookmarkNode* new_parent = |
416 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 416 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
417 if (new_parent != node->GetParent()) { | 417 if (new_parent != node->GetParent()) { |
418 UserMetrics::RecordAction( | 418 UserMetrics::RecordAction( |
419 UserMetricsAction("BookmarkBubble_ChangeParent"), profile_); | 419 UserMetricsAction("BookmarkBubble_ChangeParent"), profile_); |
420 model->Move(node, new_parent, new_parent->GetChildCount()); | 420 model->Move(node, new_parent, new_parent->GetChildCount()); |
421 } | 421 } |
422 } | 422 } |
423 } | 423 } |
424 } | 424 } |
OLD | NEW |