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/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" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 views::View* BookmarkBubbleView::GetInitiallyFocusedView() { | 120 views::View* BookmarkBubbleView::GetInitiallyFocusedView() { |
121 return title_tf_; | 121 return title_tf_; |
122 } | 122 } |
123 | 123 |
124 void BookmarkBubbleView::WindowClosing() { | 124 void BookmarkBubbleView::WindowClosing() { |
125 // We have to reset |bubble_| here, not in our destructor, because we'll be | 125 // We have to reset |bubble_| here, not in our destructor, because we'll be |
126 // destroyed asynchronously and the shown state will be checked before then. | 126 // destroyed asynchronously and the shown state will be checked before then. |
127 DCHECK(bookmark_bubble_ == this); | 127 DCHECK_EQ(bookmark_bubble_, this); |
128 bookmark_bubble_ = NULL; | 128 bookmark_bubble_ = NULL; |
129 | 129 |
130 content::NotificationService::current()->Notify( | 130 content::NotificationService::current()->Notify( |
131 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, | 131 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, |
132 content::Source<Profile>(profile_->GetOriginalProfile()), | 132 content::Source<Profile>(profile_->GetOriginalProfile()), |
133 content::NotificationService::NoDetails()); | 133 content::NotificationService::NoDetails()); |
134 } | 134 } |
135 | 135 |
136 bool BookmarkBubbleView::AcceleratorPressed( | 136 bool BookmarkBubbleView::AcceleratorPressed( |
137 const ui::Accelerator& accelerator) { | 137 const ui::Accelerator& accelerator) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 NOTREACHED(); | 270 NOTREACHED(); |
271 return string16(); | 271 return string16(); |
272 } | 272 } |
273 | 273 |
274 void BookmarkBubbleView::ButtonPressed( | 274 void BookmarkBubbleView::ButtonPressed( |
275 views::Button* sender, const ui::Event& event) { | 275 views::Button* sender, const ui::Event& event) { |
276 HandleButtonPressed(sender); | 276 HandleButtonPressed(sender); |
277 } | 277 } |
278 | 278 |
279 void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) { | 279 void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) { |
280 DCHECK(source == remove_link_); | 280 DCHECK_EQ(remove_link_, source); |
281 content::RecordAction(UserMetricsAction("BookmarkBubble_Unstar")); | 281 content::RecordAction(UserMetricsAction("BookmarkBubble_Unstar")); |
282 | 282 |
283 // Set this so we remove the bookmark after the window closes. | 283 // Set this so we remove the bookmark after the window closes. |
284 remove_bookmark_ = true; | 284 remove_bookmark_ = true; |
285 apply_edits_ = false; | 285 apply_edits_ = false; |
286 StartFade(false); | 286 StartFade(false); |
287 } | 287 } |
288 | 288 |
289 void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) { | 289 void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) { |
290 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { | 290 if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 const BookmarkNode* new_parent = | 337 const BookmarkNode* new_parent = |
338 parent_model_.GetNodeAt(parent_combobox_->selected_index()); | 338 parent_model_.GetNodeAt(parent_combobox_->selected_index()); |
339 if (new_parent != node->parent()) { | 339 if (new_parent != node->parent()) { |
340 content::RecordAction( | 340 content::RecordAction( |
341 UserMetricsAction("BookmarkBubble_ChangeParent")); | 341 UserMetricsAction("BookmarkBubble_ChangeParent")); |
342 model->Move(node, new_parent, new_parent->child_count()); | 342 model->Move(node, new_parent, new_parent->child_count()); |
343 } | 343 } |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
OLD | NEW |