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 <utility> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" | 17 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" |
16 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 18 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 gfx::NativeView parent_window, | 74 gfx::NativeView parent_window, |
73 bookmarks::BookmarkBubbleObserver* observer, | 75 bookmarks::BookmarkBubbleObserver* observer, |
74 scoped_ptr<BubbleSyncPromoDelegate> delegate, | 76 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
75 Profile* profile, | 77 Profile* profile, |
76 const GURL& url, | 78 const GURL& url, |
77 bool already_bookmarked) { | 79 bool already_bookmarked) { |
78 if (bookmark_bubble_) | 80 if (bookmark_bubble_) |
79 return; | 81 return; |
80 | 82 |
81 bookmark_bubble_ = | 83 bookmark_bubble_ = |
82 new BookmarkBubbleView(anchor_view, observer, delegate.Pass(), profile, | 84 new BookmarkBubbleView(anchor_view, observer, std::move(delegate), |
83 url, !already_bookmarked); | 85 profile, url, !already_bookmarked); |
84 if (!anchor_view) { | 86 if (!anchor_view) { |
85 bookmark_bubble_->SetAnchorRect(anchor_rect); | 87 bookmark_bubble_->SetAnchorRect(anchor_rect); |
86 bookmark_bubble_->set_parent_window(parent_window); | 88 bookmark_bubble_->set_parent_window(parent_window); |
87 } | 89 } |
88 views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show(); | 90 views::BubbleDelegateView::CreateBubble(bookmark_bubble_)->Show(); |
89 // Select the entire title textfield contents when the bubble is first shown. | 91 // Select the entire title textfield contents when the bubble is first shown. |
90 bookmark_bubble_->title_tf_->SelectAll(true); | 92 bookmark_bubble_->title_tf_->SelectAll(true); |
91 bookmark_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); | 93 bookmark_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); |
92 | 94 |
93 if (bookmark_bubble_->observer_) { | 95 if (bookmark_bubble_->observer_) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 283 |
282 BookmarkBubbleView::BookmarkBubbleView( | 284 BookmarkBubbleView::BookmarkBubbleView( |
283 views::View* anchor_view, | 285 views::View* anchor_view, |
284 bookmarks::BookmarkBubbleObserver* observer, | 286 bookmarks::BookmarkBubbleObserver* observer, |
285 scoped_ptr<BubbleSyncPromoDelegate> delegate, | 287 scoped_ptr<BubbleSyncPromoDelegate> delegate, |
286 Profile* profile, | 288 Profile* profile, |
287 const GURL& url, | 289 const GURL& url, |
288 bool newly_bookmarked) | 290 bool newly_bookmarked) |
289 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 291 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
290 observer_(observer), | 292 observer_(observer), |
291 delegate_(delegate.Pass()), | 293 delegate_(std::move(delegate)), |
292 profile_(profile), | 294 profile_(profile), |
293 url_(url), | 295 url_(url), |
294 newly_bookmarked_(newly_bookmarked), | 296 newly_bookmarked_(newly_bookmarked), |
295 parent_model_(BookmarkModelFactory::GetForProfile(profile_), | 297 parent_model_(BookmarkModelFactory::GetForProfile(profile_), |
296 BookmarkModelFactory::GetForProfile(profile_) | 298 BookmarkModelFactory::GetForProfile(profile_) |
297 ->GetMostRecentlyAddedUserNodeForURL(url)), | 299 ->GetMostRecentlyAddedUserNodeForURL(url)), |
298 remove_button_(NULL), | 300 remove_button_(NULL), |
299 edit_button_(NULL), | 301 edit_button_(NULL), |
300 close_button_(NULL), | 302 close_button_(NULL), |
301 title_tf_(NULL), | 303 title_tf_(NULL), |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 if (node) { | 385 if (node) { |
384 const base::string16 new_title = title_tf_->text(); | 386 const base::string16 new_title = title_tf_->text(); |
385 if (new_title != node->GetTitle()) { | 387 if (new_title != node->GetTitle()) { |
386 model->SetTitle(node, new_title); | 388 model->SetTitle(node, new_title); |
387 content::RecordAction( | 389 content::RecordAction( |
388 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); | 390 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); |
389 } | 391 } |
390 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); | 392 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); |
391 } | 393 } |
392 } | 394 } |
OLD | NEW |