OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Padding between "Title:" and the actual title. | 39 // Padding between "Title:" and the actual title. |
40 static const int kTitlePadding = 4; | 40 static const int kTitlePadding = 4; |
41 | 41 |
42 // Minimum width for the fields - they will push out the size of the bubble if | 42 // Minimum width for the fields - they will push out the size of the bubble if |
43 // necessary. This should be big enough so that the field pushes the right side | 43 // necessary. This should be big enough so that the field pushes the right side |
44 // of the bubble far enough so that the edit button's left edge is to the right | 44 // of the bubble far enough so that the edit button's left edge is to the right |
45 // of the field's left edge. | 45 // of the field's left edge. |
46 static const int kMinimumFieldSize = 180; | 46 static const int kMinimumFieldSize = 180; |
47 | 47 |
48 // TODO(msw): Get color from theme/window color. | |
49 static const SkColor kColor = SK_ColorWHITE; | |
50 | |
51 // Declared in browser_dialogs.h so callers don't have to depend on our header. | 48 // Declared in browser_dialogs.h so callers don't have to depend on our header. |
52 | 49 |
53 namespace browser { | 50 namespace browser { |
54 | 51 |
55 void ShowBookmarkBubbleView(views::View* anchor_view, | 52 void ShowBookmarkBubbleView(views::View* anchor_view, |
56 Profile* profile, | 53 Profile* profile, |
57 const GURL& url, | 54 const GURL& url, |
58 bool newly_bookmarked) { | 55 bool newly_bookmarked) { |
59 BookmarkBubbleView::ShowBubble(anchor_view, profile, url, newly_bookmarked); | 56 BookmarkBubbleView::ShowBubble(anchor_view, profile, url, newly_bookmarked); |
60 } | 57 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 layout->AddView(edit_button_); | 234 layout->AddView(edit_button_); |
238 layout->AddView(close_button_); | 235 layout->AddView(close_button_); |
239 | 236 |
240 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, 0)); | 237 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, 0)); |
241 } | 238 } |
242 | 239 |
243 BookmarkBubbleView::BookmarkBubbleView(views::View* anchor_view, | 240 BookmarkBubbleView::BookmarkBubbleView(views::View* anchor_view, |
244 Profile* profile, | 241 Profile* profile, |
245 const GURL& url, | 242 const GURL& url, |
246 bool newly_bookmarked) | 243 bool newly_bookmarked) |
247 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT, kColor), | 244 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
248 profile_(profile), | 245 profile_(profile), |
249 url_(url), | 246 url_(url), |
250 newly_bookmarked_(newly_bookmarked), | 247 newly_bookmarked_(newly_bookmarked), |
251 parent_model_( | 248 parent_model_( |
252 profile_->GetBookmarkModel(), | 249 profile_->GetBookmarkModel(), |
253 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url)), | 250 profile_->GetBookmarkModel()->GetMostRecentlyAddedNodeForURL(url)), |
254 remove_bookmark_(false), | 251 remove_bookmark_(false), |
255 apply_edits_(true) { | 252 apply_edits_(true) { |
256 } | 253 } |
257 | 254 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 const BookmarkNode* new_parent = | 330 const BookmarkNode* new_parent = |
334 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 331 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
335 if (new_parent != node->parent()) { | 332 if (new_parent != node->parent()) { |
336 UserMetrics::RecordAction( | 333 UserMetrics::RecordAction( |
337 UserMetricsAction("BookmarkBubble_ChangeParent")); | 334 UserMetricsAction("BookmarkBubble_ChangeParent")); |
338 model->Move(node, new_parent, new_parent->child_count()); | 335 model->Move(node, new_parent, new_parent->child_count()); |
339 } | 336 } |
340 } | 337 } |
341 } | 338 } |
342 } | 339 } |
OLD | NEW |