| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bookmark_bubble_view.h" | 5 #include "chrome/browser/views/bookmark_bubble_view.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/color_utils.h" | 8 #include "app/gfx/color_utils.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 #else | 413 #else |
| 414 gfx::NativeWindow parent = GTK_WINDOW( | 414 gfx::NativeWindow parent = GTK_WINDOW( |
| 415 static_cast<views::WidgetGtk*>(GetWidget())->GetTransientParent()); | 415 static_cast<views::WidgetGtk*>(GetWidget())->GetTransientParent()); |
| 416 #endif | 416 #endif |
| 417 | 417 |
| 418 // Even though we just hid the window, we need to invoke Close to schedule | 418 // Even though we just hid the window, we need to invoke Close to schedule |
| 419 // the delete and all that. | 419 // the delete and all that. |
| 420 Close(); | 420 Close(); |
| 421 | 421 |
| 422 if (node) { | 422 if (node) { |
| 423 BookmarkEditor::Show(parent, profile_, NULL, node, | 423 BookmarkEditor::Show(parent, profile_, NULL, |
| 424 BookmarkEditor::EditDetails(node), |
| 424 BookmarkEditor::SHOW_TREE, NULL); | 425 BookmarkEditor::SHOW_TREE, NULL); |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 void BookmarkBubbleView::ApplyEdits() { | 429 void BookmarkBubbleView::ApplyEdits() { |
| 429 // Set this to make sure we don't attempt to apply edits again. | 430 // Set this to make sure we don't attempt to apply edits again. |
| 430 apply_edits_ = false; | 431 apply_edits_ = false; |
| 431 | 432 |
| 432 BookmarkModel* model = profile_->GetBookmarkModel(); | 433 BookmarkModel* model = profile_->GetBookmarkModel(); |
| 433 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); | 434 const BookmarkNode* node = model->GetMostRecentlyAddedNodeForURL(url_); |
| 434 if (node) { | 435 if (node) { |
| 435 const std::wstring new_title = UTF16ToWide(title_tf_->text()); | 436 const std::wstring new_title = UTF16ToWide(title_tf_->text()); |
| 436 if (new_title != node->GetTitle()) { | 437 if (new_title != node->GetTitle()) { |
| 437 model->SetTitle(node, new_title); | 438 model->SetTitle(node, new_title); |
| 438 UserMetrics::RecordAction(L"BookmarkBubble_ChangeTitleInBubble", | 439 UserMetrics::RecordAction(L"BookmarkBubble_ChangeTitleInBubble", |
| 439 profile_); | 440 profile_); |
| 440 } | 441 } |
| 441 // Last index means 'Choose another folder...' | 442 // Last index means 'Choose another folder...' |
| 442 if (parent_combobox_->selected_item() < | 443 if (parent_combobox_->selected_item() < |
| 443 parent_model_.GetItemCount() - 1) { | 444 parent_model_.GetItemCount() - 1) { |
| 444 const BookmarkNode* new_parent = | 445 const BookmarkNode* new_parent = |
| 445 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 446 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
| 446 if (new_parent != node->GetParent()) { | 447 if (new_parent != node->GetParent()) { |
| 447 UserMetrics::RecordAction(L"BookmarkBubble_ChangeParent", profile_); | 448 UserMetrics::RecordAction(L"BookmarkBubble_ChangeParent", profile_); |
| 448 model->Move(node, new_parent, new_parent->GetChildCount()); | 449 model->Move(node, new_parent, new_parent->GetChildCount()); |
| 449 } | 450 } |
| 450 } | 451 } |
| 451 } | 452 } |
| 452 } | 453 } |
| OLD | NEW |