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/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); | 102 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); |
103 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url_); | 103 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url_); |
104 if (node) | 104 if (node) |
105 model->Remove(node->parent(), node->parent()->GetIndexOf(node)); | 105 model->Remove(node->parent(), node->parent()->GetIndexOf(node)); |
106 } | 106 } |
107 // |parent_combobox_| needs to be destroyed before |parent_model_| as it | 107 // |parent_combobox_| needs to be destroyed before |parent_model_| as it |
108 // uses |parent_model_| in its destructor. | 108 // uses |parent_model_| in its destructor. |
109 delete parent_combobox_; | 109 delete parent_combobox_; |
110 } | 110 } |
111 | 111 |
112 views::View* BookmarkBubbleView::GetInitiallyFocusedView() { | |
113 return title_tf_; | |
114 } | |
115 | |
116 void BookmarkBubbleView::WindowClosing() { | 112 void BookmarkBubbleView::WindowClosing() { |
117 // We have to reset |bubble_| here, not in our destructor, because we'll be | 113 // We have to reset |bubble_| here, not in our destructor, because we'll be |
118 // destroyed asynchronously and the shown state will be checked before then. | 114 // destroyed asynchronously and the shown state will be checked before then. |
119 DCHECK_EQ(bookmark_bubble_, this); | 115 DCHECK_EQ(bookmark_bubble_, this); |
120 bookmark_bubble_ = NULL; | 116 bookmark_bubble_ = NULL; |
121 | 117 |
122 if (observer_) | 118 if (observer_) |
123 observer_->OnBookmarkBubbleHidden(); | 119 observer_->OnBookmarkBubbleHidden(); |
124 } | 120 } |
125 | 121 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 251 |
256 sync_promo_view_ = new BookmarkSyncPromoView(delegate_.get()); | 252 sync_promo_view_ = new BookmarkSyncPromoView(delegate_.get()); |
257 layout->AddView(sync_promo_view_); | 253 layout->AddView(sync_promo_view_); |
258 } | 254 } |
259 | 255 |
260 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); | 256 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); |
261 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); | 257 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); |
262 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); | 258 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); |
263 } | 259 } |
264 | 260 |
| 261 const char* BookmarkBubbleView::GetClassName() const { |
| 262 return "BookmarkBubbleView"; |
| 263 } |
| 264 |
| 265 views::View* BookmarkBubbleView::GetInitiallyFocusedView() { |
| 266 return title_tf_; |
| 267 } |
| 268 |
265 BookmarkBubbleView::BookmarkBubbleView( | 269 BookmarkBubbleView::BookmarkBubbleView( |
266 views::View* anchor_view, | 270 views::View* anchor_view, |
267 BookmarkBubbleViewObserver* observer, | 271 BookmarkBubbleViewObserver* observer, |
268 scoped_ptr<BookmarkBubbleDelegate> delegate, | 272 scoped_ptr<BookmarkBubbleDelegate> delegate, |
269 Profile* profile, | 273 Profile* profile, |
270 const GURL& url, | 274 const GURL& url, |
271 bool newly_bookmarked) | 275 bool newly_bookmarked) |
272 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 276 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
273 observer_(observer), | 277 observer_(observer), |
274 delegate_(delegate.Pass()), | 278 delegate_(delegate.Pass()), |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (node) { | 369 if (node) { |
366 const base::string16 new_title = title_tf_->text(); | 370 const base::string16 new_title = title_tf_->text(); |
367 if (new_title != node->GetTitle()) { | 371 if (new_title != node->GetTitle()) { |
368 model->SetTitle(node, new_title); | 372 model->SetTitle(node, new_title); |
369 content::RecordAction( | 373 content::RecordAction( |
370 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); | 374 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); |
371 } | 375 } |
372 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); | 376 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); |
373 } | 377 } |
374 } | 378 } |
OLD | NEW |