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" |
11 #include "chrome/browser/bookmarks/bookmark_editor.h" | 11 #include "chrome/browser/bookmarks/bookmark_editor.h" |
12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/bookmarks/bookmark_utils.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/browser/ui/views/window.h" |
17 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/browser/user_metrics.h" | 19 #include "content/browser/user_metrics.h" |
19 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
22 #include "ui/base/keycodes/keyboard_codes.h" | 23 #include "ui/base/keycodes/keyboard_codes.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/views/events/event.h" | 26 #include "ui/views/events/event.h" |
26 #include "ui/views/layout/grid_layout.h" | 27 #include "ui/views/layout/grid_layout.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // static | 75 // static |
75 void BookmarkBubbleView::ShowBubble(views::View* anchor_view, | 76 void BookmarkBubbleView::ShowBubble(views::View* anchor_view, |
76 Profile* profile, | 77 Profile* profile, |
77 const GURL& url, | 78 const GURL& url, |
78 bool newly_bookmarked) { | 79 bool newly_bookmarked) { |
79 if (IsShowing()) | 80 if (IsShowing()) |
80 return; | 81 return; |
81 | 82 |
82 bookmark_bubble_ = | 83 bookmark_bubble_ = |
83 new BookmarkBubbleView(anchor_view, profile, url, newly_bookmarked); | 84 new BookmarkBubbleView(anchor_view, profile, url, newly_bookmarked); |
84 views::BubbleDelegateView::CreateBubble(bookmark_bubble_); | 85 browser::CreateViewsBubble(bookmark_bubble_); |
85 bookmark_bubble_->Show(); | 86 bookmark_bubble_->Show(); |
86 // Select the entire title textfield contents when the bubble is first shown. | 87 // Select the entire title textfield contents when the bubble is first shown. |
87 bookmark_bubble_->title_tf_->SelectAll(); | 88 bookmark_bubble_->title_tf_->SelectAll(); |
88 | 89 |
89 GURL url_ptr(url); | 90 GURL url_ptr(url); |
90 content::NotificationService::current()->Notify( | 91 content::NotificationService::current()->Notify( |
91 chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, | 92 chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, |
92 content::Source<Profile>(profile->GetOriginalProfile()), | 93 content::Source<Profile>(profile->GetOriginalProfile()), |
93 content::Details<GURL>(&url_ptr)); | 94 content::Details<GURL>(&url_ptr)); |
94 } | 95 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 const BookmarkNode* new_parent = | 332 const BookmarkNode* new_parent = |
332 parent_model_.GetNodeAt(parent_combobox_->selected_item()); | 333 parent_model_.GetNodeAt(parent_combobox_->selected_item()); |
333 if (new_parent != node->parent()) { | 334 if (new_parent != node->parent()) { |
334 UserMetrics::RecordAction( | 335 UserMetrics::RecordAction( |
335 UserMetricsAction("BookmarkBubble_ChangeParent")); | 336 UserMetricsAction("BookmarkBubble_ChangeParent")); |
336 model->Move(node, new_parent, new_parent->child_count()); | 337 model->Move(node, new_parent, new_parent->child_count()); |
337 } | 338 } |
338 } | 339 } |
339 } | 340 } |
340 } | 341 } |
OLD | NEW |