| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 return false; | 339 return false; |
| 340 } | 340 } |
| 341 | 341 |
| 342 std::wstring BookmarkBubbleView::accessible_name() { | 342 std::wstring BookmarkBubbleView::accessible_name() { |
| 343 return UTF16ToWide( | 343 return UTF16ToWide( |
| 344 l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK)); | 344 l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK)); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void BookmarkBubbleView::Close() { | 347 void BookmarkBubbleView::Close() { |
| 348 ApplyEdits(); | 348 ApplyEdits(); |
| 349 static_cast<Bubble*>(GetWidget())->Close(); | 349 GetWidget()->Close(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { | 352 void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) { |
| 353 if (sender == edit_button_) { | 353 if (sender == edit_button_) { |
| 354 UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Edit")); | 354 UserMetrics::RecordAction(UserMetricsAction("BookmarkBubble_Edit")); |
| 355 bubble_->set_fade_away_on_close(true); | 355 bubble_->set_fade_away_on_close(true); |
| 356 ShowEditor(); | 356 ShowEditor(); |
| 357 } else { | 357 } else { |
| 358 DCHECK(sender == close_button_); | 358 DCHECK(sender == close_button_); |
| 359 bubble_->set_fade_away_on_close(true); | 359 bubble_->set_fade_away_on_close(true); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 380 // We're about to show the bookmark editor. When the bookmark editor closes | 380 // We're about to show the bookmark editor. When the bookmark editor closes |
| 381 // we want the browser to become active. WidgetWin::Hide() does a hide in | 381 // we want the browser to become active. WidgetWin::Hide() does a hide in |
| 382 // a such way that activation isn't changed, which means when we close | 382 // a such way that activation isn't changed, which means when we close |
| 383 // Windows gets confused as to who it should give active status to. We | 383 // Windows gets confused as to who it should give active status to. We |
| 384 // explicitly hide the bookmark bubble window in such a way that activation | 384 // explicitly hide the bookmark bubble window in such a way that activation |
| 385 // status changes. That way, when the editor closes, activation is properly | 385 // status changes. That way, when the editor closes, activation is properly |
| 386 // restored to the browser. | 386 // restored to the browser. |
| 387 ShowWindow(GetWidget()->GetNativeView(), SW_HIDE); | 387 ShowWindow(GetWidget()->GetNativeView(), SW_HIDE); |
| 388 #elif defined(TOOLKIT_USES_GTK) | 388 #elif defined(TOOLKIT_USES_GTK) |
| 389 gfx::NativeWindow parent = GTK_WINDOW( | 389 gfx::NativeWindow parent = GTK_WINDOW( |
| 390 static_cast<views::WidgetGtk*>(GetWidget())->GetTransientParent()); | 390 static_cast<views::WidgetGtk*>(GetWidget()->native_widget())-> |
| 391 GetTransientParent()); |
| 391 #endif | 392 #endif |
| 392 | 393 |
| 393 // Even though we just hid the window, we need to invoke Close to schedule | 394 // Even though we just hid the window, we need to invoke Close to schedule |
| 394 // the delete and all that. | 395 // the delete and all that. |
| 395 Close(); | 396 Close(); |
| 396 | 397 |
| 397 if (node) { | 398 if (node) { |
| 398 BookmarkEditor::Show(parent, profile_, NULL, | 399 BookmarkEditor::Show(parent, profile_, NULL, |
| 399 BookmarkEditor::EditDetails(node), | 400 BookmarkEditor::EditDetails(node), |
| 400 BookmarkEditor::SHOW_TREE); | 401 BookmarkEditor::SHOW_TREE); |
| (...skipping 20 matching lines...) Expand all 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 |