Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 1802073002: Makes vertical alignment of location bar bubbles same (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Makes vertical alignment of location bar bubbles same (comments) Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if (bookmark_bubble_) 77 if (bookmark_bubble_)
78 return nullptr; 78 return nullptr;
79 79
80 bookmark_bubble_ = 80 bookmark_bubble_ =
81 new BookmarkBubbleView(anchor_view, observer, std::move(delegate), 81 new BookmarkBubbleView(anchor_view, observer, std::move(delegate),
82 profile, url, !already_bookmarked); 82 profile, url, !already_bookmarked);
83 if (!anchor_view) { 83 if (!anchor_view) {
84 bookmark_bubble_->SetAnchorRect(anchor_rect); 84 bookmark_bubble_->SetAnchorRect(anchor_rect);
85 bookmark_bubble_->set_parent_window(parent_window); 85 bookmark_bubble_->set_parent_window(parent_window);
86 } 86 }
87 // Compensate for built-in vertical padding in the anchor view's image.
88 // This is different from 5 pixel inset that is used in other cases because
89 // this bubble is using NONE as the arrow type.
90 bookmark_bubble_->set_anchor_view_insets(gfx::Insets(-1, 0));
Peter Kasting 2016/03/14 22:35:51 Do you still need to do this if you use PAINT_TRAN
varkha 2016/03/15 00:11:42 That would indeed be great and I wanted to do that
Evan Stade 2016/03/15 00:13:27 I think it should be possible and it's probably a
Peter Kasting 2016/03/15 00:34:15 Yeah, I'd like to see if this is easy enough to do
varkha 2016/03/16 03:45:30 I have tried to pursue this. I can make the Bubble
87 views::Widget* bubble_widget = 91 views::Widget* bubble_widget =
88 views::BubbleDialogDelegateView::CreateBubble(bookmark_bubble_); 92 views::BubbleDialogDelegateView::CreateBubble(bookmark_bubble_);
89 bubble_widget->Show(); 93 bubble_widget->Show();
90 // Select the entire title textfield contents when the bubble is first shown. 94 // Select the entire title textfield contents when the bubble is first shown.
91 bookmark_bubble_->title_tf_->SelectAll(true); 95 bookmark_bubble_->title_tf_->SelectAll(true);
92 bookmark_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 96 bookmark_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
93 97
94 if (bookmark_bubble_->observer_) { 98 if (bookmark_bubble_->observer_) {
95 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); 99 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
96 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url); 100 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 parent_model_(BookmarkModelFactory::GetForProfile(profile_), 270 parent_model_(BookmarkModelFactory::GetForProfile(profile_),
267 BookmarkModelFactory::GetForProfile(profile_) 271 BookmarkModelFactory::GetForProfile(profile_)
268 ->GetMostRecentlyAddedUserNodeForURL(url)), 272 ->GetMostRecentlyAddedUserNodeForURL(url)),
269 remove_button_(NULL), 273 remove_button_(NULL),
270 edit_button_(NULL), 274 edit_button_(NULL),
271 close_button_(NULL), 275 close_button_(NULL),
272 title_tf_(NULL), 276 title_tf_(NULL),
273 parent_combobox_(NULL), 277 parent_combobox_(NULL),
274 remove_bookmark_(false), 278 remove_bookmark_(false),
275 apply_edits_(true) { 279 apply_edits_(true) {
276 // Compensate for built-in vertical padding in the anchor view's image.
277 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
278 } 280 }
279 281
280 base::string16 BookmarkBubbleView::GetTitle() { 282 base::string16 BookmarkBubbleView::GetTitle() {
281 BookmarkModel* bookmark_model = 283 BookmarkModel* bookmark_model =
282 BookmarkModelFactory::GetForProfile(profile_); 284 BookmarkModelFactory::GetForProfile(profile_);
283 const BookmarkNode* node = 285 const BookmarkNode* node =
284 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_); 286 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_);
285 if (node) 287 if (node)
286 return node->GetTitle(); 288 return node->GetTitle();
287 else 289 else
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (node) { 354 if (node) {
353 const base::string16 new_title = title_tf_->text(); 355 const base::string16 new_title = title_tf_->text();
354 if (new_title != node->GetTitle()) { 356 if (new_title != node->GetTitle()) {
355 model->SetTitle(node, new_title); 357 model->SetTitle(node, new_title);
356 content::RecordAction( 358 content::RecordAction(
357 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 359 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
358 } 360 }
359 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); 361 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index());
360 } 362 }
361 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698