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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 parent_combobox_ = new views::Combobox(&parent_model_); | 165 parent_combobox_ = new views::Combobox(&parent_model_); |
166 parent_combobox_->set_listener(this); | 166 parent_combobox_->set_listener(this); |
167 parent_combobox_->SetAccessibleName(combobox_label->text()); | 167 parent_combobox_->SetAccessibleName(combobox_label->text()); |
168 | 168 |
169 views::Label* title_label = new views::Label( | 169 views::Label* title_label = new views::Label( |
170 l10n_util::GetStringUTF16( | 170 l10n_util::GetStringUTF16( |
171 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : | 171 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : |
172 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK)); | 172 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK)); |
173 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 173 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
174 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 174 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
175 title_label->SetEnabledColor(SkColorSetRGB(6, 45, 117)); | |
176 | 175 |
177 GridLayout* layout = new GridLayout(this); | 176 GridLayout* layout = new GridLayout(this); |
178 SetLayoutManager(layout); | 177 SetLayoutManager(layout); |
179 | 178 |
180 ColumnSet* cs = layout->AddColumnSet(0); | 179 ColumnSet* cs = layout->AddColumnSet(0); |
181 | 180 |
182 // Top (title) row. | 181 // Top (title) row. |
183 cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF, | 182 cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF, |
184 0, 0); | 183 0, 0); |
185 cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing); | 184 cs->AddPaddingColumn(1, views::kUnrelatedControlHorizontalSpacing); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 BookmarkModelFactory::GetForProfile(profile_), | 246 BookmarkModelFactory::GetForProfile(profile_), |
248 BookmarkModelFactory::GetForProfile(profile_)-> | 247 BookmarkModelFactory::GetForProfile(profile_)-> |
249 GetMostRecentlyAddedNodeForURL(url)), | 248 GetMostRecentlyAddedNodeForURL(url)), |
250 remove_link_(NULL), | 249 remove_link_(NULL), |
251 edit_button_(NULL), | 250 edit_button_(NULL), |
252 close_button_(NULL), | 251 close_button_(NULL), |
253 title_tf_(NULL), | 252 title_tf_(NULL), |
254 parent_combobox_(NULL), | 253 parent_combobox_(NULL), |
255 remove_bookmark_(false), | 254 remove_bookmark_(false), |
256 apply_edits_(true) { | 255 apply_edits_(true) { |
256 set_margins(gfx::Insets(20, 20, 20, 20)); | |
msw
2013/05/27 20:47:32
The margins look absurd without control size/place
| |
257 // Compensate for built-in vertical padding in the anchor view's image. | 257 // Compensate for built-in vertical padding in the anchor view's image. |
258 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); | 258 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); |
259 } | 259 } |
260 | 260 |
261 string16 BookmarkBubbleView::GetTitle() { | 261 string16 BookmarkBubbleView::GetTitle() { |
262 BookmarkModel* bookmark_model = | 262 BookmarkModel* bookmark_model = |
263 BookmarkModelFactory::GetForProfile(profile_); | 263 BookmarkModelFactory::GetForProfile(profile_); |
264 const BookmarkNode* node = | 264 const BookmarkNode* node = |
265 bookmark_model->GetMostRecentlyAddedNodeForURL(url_); | 265 bookmark_model->GetMostRecentlyAddedNodeForURL(url_); |
266 if (node) | 266 if (node) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 if (node) { | 327 if (node) { |
328 const string16 new_title = title_tf_->text(); | 328 const string16 new_title = title_tf_->text(); |
329 if (new_title != node->GetTitle()) { | 329 if (new_title != node->GetTitle()) { |
330 model->SetTitle(node, new_title); | 330 model->SetTitle(node, new_title); |
331 content::RecordAction( | 331 content::RecordAction( |
332 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); | 332 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); |
333 } | 333 } |
334 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); | 334 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); |
335 } | 335 } |
336 } | 336 } |
OLD | NEW |