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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); | 114 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); |
115 if (node) | 115 if (node) |
116 model->Remove(node->parent(), node->parent()->GetIndexOf(node)); | 116 model->Remove(node->parent(), node->parent()->GetIndexOf(node)); |
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 gfx::Rect BookmarkBubbleView::GetAnchorRect() { | |
125 // Compensate for some built-in padding in the star image. | |
126 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); | |
127 rect.Inset(0, anchor_view() ? 5 : 0); | |
128 return rect; | |
129 } | |
130 | |
131 void BookmarkBubbleView::WindowClosing() { | 124 void BookmarkBubbleView::WindowClosing() { |
132 // 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 |
133 // destroyed asynchronously and the shown state will be checked before then. | 126 // destroyed asynchronously and the shown state will be checked before then. |
134 DCHECK(bookmark_bubble_ == this); | 127 DCHECK(bookmark_bubble_ == this); |
135 bookmark_bubble_ = NULL; | 128 bookmark_bubble_ = NULL; |
136 | 129 |
137 content::NotificationService::current()->Notify( | 130 content::NotificationService::current()->Notify( |
138 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, | 131 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, |
139 content::Source<Profile>(profile_->GetOriginalProfile()), | 132 content::Source<Profile>(profile_->GetOriginalProfile()), |
140 content::NotificationService::NoDetails()); | 133 content::NotificationService::NoDetails()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 BookmarkModelFactory::GetForProfile(profile_), | 248 BookmarkModelFactory::GetForProfile(profile_), |
256 BookmarkModelFactory::GetForProfile(profile_)-> | 249 BookmarkModelFactory::GetForProfile(profile_)-> |
257 GetMostRecentlyAddedNodeForURL(url)), | 250 GetMostRecentlyAddedNodeForURL(url)), |
258 remove_link_(NULL), | 251 remove_link_(NULL), |
259 edit_button_(NULL), | 252 edit_button_(NULL), |
260 close_button_(NULL), | 253 close_button_(NULL), |
261 title_tf_(NULL), | 254 title_tf_(NULL), |
262 parent_combobox_(NULL), | 255 parent_combobox_(NULL), |
263 remove_bookmark_(false), | 256 remove_bookmark_(false), |
264 apply_edits_(true) { | 257 apply_edits_(true) { |
| 258 // Compensate for built-in vertical padding in the anchor view's image. |
| 259 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); |
265 } | 260 } |
266 | 261 |
267 string16 BookmarkBubbleView::GetTitle() { | 262 string16 BookmarkBubbleView::GetTitle() { |
268 BookmarkModel* bookmark_model = | 263 BookmarkModel* bookmark_model = |
269 BookmarkModelFactory::GetForProfile(profile_); | 264 BookmarkModelFactory::GetForProfile(profile_); |
270 const BookmarkNode* node = | 265 const BookmarkNode* node = |
271 bookmark_model->GetMostRecentlyAddedNodeForURL(url_); | 266 bookmark_model->GetMostRecentlyAddedNodeForURL(url_); |
272 if (node) | 267 if (node) |
273 return node->GetTitle(); | 268 return node->GetTitle(); |
274 else | 269 else |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 const BookmarkNode* new_parent = | 337 const BookmarkNode* new_parent = |
343 parent_model_.GetNodeAt(parent_combobox_->selected_index()); | 338 parent_model_.GetNodeAt(parent_combobox_->selected_index()); |
344 if (new_parent != node->parent()) { | 339 if (new_parent != node->parent()) { |
345 content::RecordAction( | 340 content::RecordAction( |
346 UserMetricsAction("BookmarkBubble_ChangeParent")); | 341 UserMetricsAction("BookmarkBubble_ChangeParent")); |
347 model->Move(node, new_parent, new_parent->child_count()); | 342 model->Move(node, new_parent, new_parent->child_count()); |
348 } | 343 } |
349 } | 344 } |
350 } | 345 } |
351 } | 346 } |
OLD | NEW |