| OLD | NEW |
| 1 // Copyright (c) 2010 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/views/bookmark_bubble_view.h" | 5 #include "chrome/browser/views/bookmark_bubble_view.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | 7 #include "app/keyboard_codes.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 Profile* profile, | 85 Profile* profile, |
| 86 const GURL& url, | 86 const GURL& url, |
| 87 bool newly_bookmarked) { | 87 bool newly_bookmarked) { |
| 88 if (IsShowing()) | 88 if (IsShowing()) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 bubble_ = new BookmarkBubbleView(delegate, profile, url, newly_bookmarked); | 91 bubble_ = new BookmarkBubbleView(delegate, profile, url, newly_bookmarked); |
| 92 InfoBubble* info_bubble = InfoBubble::Show( | 92 InfoBubble* info_bubble = InfoBubble::Show( |
| 93 parent->GetClientView()->GetWidget(), bounds, BubbleBorder::TOP_RIGHT, | 93 parent->GetClientView()->GetWidget(), bounds, BubbleBorder::TOP_RIGHT, |
| 94 bubble_, bubble_); | 94 bubble_, bubble_); |
| 95 // |bubble_| can be set to NULL in InfoBubbleClosing when we close the bubble |
| 96 // asynchronously. However, that can happen during the Show call above if the |
| 97 // window loses activation while we are getting to ready to show the bubble, |
| 98 // so we must check to make sure we still have a valid bubble before |
| 99 // proceeding. |
| 100 if (!bubble_) |
| 101 return; |
| 95 bubble_->set_info_bubble(info_bubble); | 102 bubble_->set_info_bubble(info_bubble); |
| 96 info_bubble->SizeToContents(); | 103 info_bubble->SizeToContents(); |
| 97 GURL url_ptr(url); | 104 GURL url_ptr(url); |
| 98 NotificationService::current()->Notify( | 105 NotificationService::current()->Notify( |
| 99 NotificationType::BOOKMARK_BUBBLE_SHOWN, | 106 NotificationType::BOOKMARK_BUBBLE_SHOWN, |
| 100 Source<Profile>(profile->GetOriginalProfile()), | 107 Source<Profile>(profile->GetOriginalProfile()), |
| 101 Details<GURL>(&url_ptr)); | 108 Details<GURL>(&url_ptr)); |
| 102 bubble_->BubbleShown(); | 109 bubble_->BubbleShown(); |
| 103 } | 110 } |
| 104 | 111 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 const BookmarkNode* new_parent = | 415 const BookmarkNode* new_parent = |
| 409 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 416 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
| 410 if (new_parent != node->GetParent()) { | 417 if (new_parent != node->GetParent()) { |
| 411 UserMetrics::RecordAction( | 418 UserMetrics::RecordAction( |
| 412 UserMetricsAction("BookmarkBubble_ChangeParent"), profile_); | 419 UserMetricsAction("BookmarkBubble_ChangeParent"), profile_); |
| 413 model->Move(node, new_parent, new_parent->GetChildCount()); | 420 model->Move(node, new_parent, new_parent->GetChildCount()); |
| 414 } | 421 } |
| 415 } | 422 } |
| 416 } | 423 } |
| 417 } | 424 } |
| OLD | NEW |