| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 static bool initialized = false; | 183 static bool initialized = false; |
| 184 if (!initialized) { | 184 if (!initialized) { |
| 185 kTitleColor = color_utils::GetReadableColor(SkColorSetRGB(6, 45, 117), | 185 kTitleColor = color_utils::GetReadableColor(SkColorSetRGB(6, 45, 117), |
| 186 Bubble::kBackgroundColor); | 186 Bubble::kBackgroundColor); |
| 187 kCloseImage = ResourceBundle::GetSharedInstance().GetBitmapNamed( | 187 kCloseImage = ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 188 IDR_INFO_BUBBLE_CLOSE); | 188 IDR_INFO_BUBBLE_CLOSE); |
| 189 | 189 |
| 190 initialized = true; | 190 initialized = true; |
| 191 } | 191 } |
| 192 | 192 |
| 193 remove_link_ = new views::Link(l10n_util::GetStringUTF16( | 193 remove_link_ = new views::Link(UTF16ToWide(l10n_util::GetStringUTF16( |
| 194 IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); | 194 IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK))); |
| 195 remove_link_->set_listener(this); | 195 remove_link_->set_listener(this); |
| 196 | 196 |
| 197 edit_button_ = new views::NativeTextButton( | 197 edit_button_ = new views::NativeTextButton( |
| 198 this, | 198 this, |
| 199 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS))); | 199 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS))); |
| 200 | 200 |
| 201 close_button_ = new views::NativeTextButton( | 201 close_button_ = new views::NativeTextButton( |
| 202 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); | 202 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); |
| 203 close_button_->SetIsDefault(true); | 203 close_button_->SetIsDefault(true); |
| 204 | 204 |
| 205 views::Label* combobox_label = new views::Label( | 205 views::Label* combobox_label = new views::Label( |
| 206 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT)); | 206 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT))); |
| 207 | 207 |
| 208 parent_combobox_ = new views::Combobox(&parent_model_); | 208 parent_combobox_ = new views::Combobox(&parent_model_); |
| 209 parent_combobox_->SetSelectedItem(parent_model_.node_parent_index()); | 209 parent_combobox_->SetSelectedItem(parent_model_.node_parent_index()); |
| 210 parent_combobox_->set_listener(this); | 210 parent_combobox_->set_listener(this); |
| 211 parent_combobox_->SetAccessibleName(combobox_label->GetText()); | 211 parent_combobox_->SetAccessibleName( |
| 212 WideToUTF16Hack(combobox_label->GetText())); |
| 212 | 213 |
| 213 views::Label* title_label = new views::Label( | 214 views::Label* title_label = new views::Label( |
| 214 l10n_util::GetStringUTF16( | 215 UTF16ToWide(l10n_util::GetStringUTF16( |
| 215 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : | 216 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : |
| 216 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK)); | 217 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK))); |
| 217 title_label->SetFont( | 218 title_label->SetFont( |
| 218 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); | 219 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); |
| 219 title_label->SetColor(kTitleColor); | 220 title_label->SetColor(kTitleColor); |
| 220 | 221 |
| 221 GridLayout* layout = new GridLayout(this); | 222 GridLayout* layout = new GridLayout(this); |
| 222 SetLayoutManager(layout); | 223 SetLayoutManager(layout); |
| 223 | 224 |
| 224 ColumnSet* cs = layout->AddColumnSet(0); | 225 ColumnSet* cs = layout->AddColumnSet(0); |
| 225 | 226 |
| 226 // Top (title) row. | 227 // Top (title) row. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 249 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing - 2); | 250 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing - 2); |
| 250 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, | 251 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
| 251 GridLayout::USE_PREF, 0, 0); | 252 GridLayout::USE_PREF, 0, 0); |
| 252 | 253 |
| 253 layout->StartRow(0, 0); | 254 layout->StartRow(0, 0); |
| 254 layout->AddView(title_label); | 255 layout->AddView(title_label); |
| 255 layout->AddView(remove_link_); | 256 layout->AddView(remove_link_); |
| 256 | 257 |
| 257 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 258 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
| 258 layout->StartRow(0, 2); | 259 layout->StartRow(0, 2); |
| 259 layout->AddView(new views::Label( | 260 layout->AddView(new views::Label(UTF16ToWide( |
| 260 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT))); | 261 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)))); |
| 261 title_tf_ = new views::Textfield(); | 262 title_tf_ = new views::Textfield(); |
| 262 title_tf_->SetText(GetTitle()); | 263 title_tf_->SetText(GetTitle()); |
| 263 layout->AddView(title_tf_); | 264 layout->AddView(title_tf_); |
| 264 | 265 |
| 265 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 266 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
| 266 | 267 |
| 267 layout->StartRow(0, 2); | 268 layout->StartRow(0, 2); |
| 268 layout->AddView(combobox_label); | 269 layout->AddView(combobox_label); |
| 269 layout->AddView(parent_combobox_); | 270 layout->AddView(parent_combobox_); |
| 270 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 271 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 const BookmarkNode* new_parent = | 422 const BookmarkNode* new_parent = |
| 422 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 423 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
| 423 if (new_parent != node->parent()) { | 424 if (new_parent != node->parent()) { |
| 424 UserMetrics::RecordAction( | 425 UserMetrics::RecordAction( |
| 425 UserMetricsAction("BookmarkBubble_ChangeParent")); | 426 UserMetricsAction("BookmarkBubble_ChangeParent")); |
| 426 model->Move(node, new_parent, new_parent->child_count()); | 427 model->Move(node, new_parent, new_parent->child_count()); |
| 427 } | 428 } |
| 428 } | 429 } |
| 429 } | 430 } |
| 430 } | 431 } |
| OLD | NEW |