OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gtk/bookmarks/bookmark_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/bookmarks/bookmark_editor.h" | 16 #include "chrome/browser/bookmarks/bookmark_editor.h" |
17 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
18 #include "chrome/browser/bookmarks/bookmark_utils.h" | 19 #include "chrome/browser/bookmarks/bookmark_utils.h" |
19 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" | 20 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_list.h" | 23 #include "chrome/browser/ui/browser_list.h" |
23 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 24 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
24 #include "chrome/browser/ui/gtk/gtk_util.h" | 25 #include "chrome/browser/ui/gtk/gtk_util.h" |
25 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
27 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 85 } |
85 } | 86 } |
86 } | 87 } |
87 | 88 |
88 BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, | 89 BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, |
89 Profile* profile, | 90 Profile* profile, |
90 const GURL& url, | 91 const GURL& url, |
91 bool newly_bookmarked) | 92 bool newly_bookmarked) |
92 : url_(url), | 93 : url_(url), |
93 profile_(profile), | 94 profile_(profile), |
94 model_(profile->GetBookmarkModel()), | 95 model_(BookmarkModelFactory::GetForProfile(profile)), |
95 theme_service_(GtkThemeService::GetFrom(profile_)), | 96 theme_service_(GtkThemeService::GetFrom(profile_)), |
96 anchor_(anchor), | 97 anchor_(anchor), |
97 content_(NULL), | 98 content_(NULL), |
98 name_entry_(NULL), | 99 name_entry_(NULL), |
99 folder_combo_(NULL), | 100 folder_combo_(NULL), |
100 bubble_(NULL), | 101 bubble_(NULL), |
101 factory_(this), | 102 factory_(this), |
102 newly_bookmarked_(newly_bookmarked), | 103 newly_bookmarked_(newly_bookmarked), |
103 apply_edits_(true), | 104 apply_edits_(true), |
104 remove_bookmark_(false) { | 105 remove_bookmark_(false) { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // We always have nodes + 1 entries in the combo. The last entry will be | 337 // We always have nodes + 1 entries in the combo. The last entry will be |
337 // the 'Select another folder...' entry that opens the bookmark editor. | 338 // the 'Select another folder...' entry that opens the bookmark editor. |
338 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { | 339 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { |
339 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), | 340 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), |
340 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); | 341 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); |
341 } | 342 } |
342 | 343 |
343 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), | 344 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), |
344 folder_combo_model_->node_parent_index()); | 345 folder_combo_model_->node_parent_index()); |
345 } | 346 } |
OLD | NEW |