| 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/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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_editor.h" | 15 #include "chrome/browser/bookmarks/bookmark_editor.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_utils.h" | 17 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 18 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" | 18 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_util.h" | 23 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "content/browser/user_metrics.h" | 25 #include "content/browser/user_metrics.h" |
| 26 #include "content/common/notification_service.h" | 26 #include "content/common/notification_service.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "ui/base/gtk/gtk_hig_constants.h" | |
| 29 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 30 | 29 |
| 31 namespace { | 30 namespace { |
| 32 | 31 |
| 33 // We basically have a singleton, since a bubble is sort of app-modal. This | 32 // We basically have a singleton, since a bubble is sort of app-modal. This |
| 34 // keeps track of the currently open bubble, or NULL if none is open. | 33 // keeps track of the currently open bubble, or NULL if none is open. |
| 35 BookmarkBubbleGtk* g_bubble = NULL; | 34 BookmarkBubbleGtk* g_bubble = NULL; |
| 36 | 35 |
| 37 // Padding between content and edge of bubble. | 36 // Padding between content and edge of bubble. |
| 38 const int kContentBorder = 7; | 37 const int kContentBorder = 7; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); | 66 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); |
| 68 | 67 |
| 69 if (theme_service_->UsingNativeTheme()) { | 68 if (theme_service_->UsingNativeTheme()) { |
| 70 for (std::vector<GtkWidget*>::iterator it = labels_.begin(); | 69 for (std::vector<GtkWidget*>::iterator it = labels_.begin(); |
| 71 it != labels_.end(); ++it) { | 70 it != labels_.end(); ++it) { |
| 72 gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, NULL); | 71 gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, NULL); |
| 73 } | 72 } |
| 74 } else { | 73 } else { |
| 75 for (std::vector<GtkWidget*>::iterator it = labels_.begin(); | 74 for (std::vector<GtkWidget*>::iterator it = labels_.begin(); |
| 76 it != labels_.end(); ++it) { | 75 it != labels_.end(); ++it) { |
| 77 gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, &ui::kGdkBlack); | 76 gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, >k_util::kGdkBlack); |
| 78 } | 77 } |
| 79 } | 78 } |
| 80 } | 79 } |
| 81 | 80 |
| 82 BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, | 81 BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, |
| 83 Profile* profile, | 82 Profile* profile, |
| 84 const GURL& url, | 83 const GURL& url, |
| 85 bool newly_bookmarked) | 84 bool newly_bookmarked) |
| 86 : url_(url), | 85 : url_(url), |
| 87 profile_(profile), | 86 profile_(profile), |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // We always have nodes + 1 entries in the combo. The last entry will be | 341 // We always have nodes + 1 entries in the combo. The last entry will be |
| 343 // the 'Select another folder...' entry that opens the bookmark editor. | 342 // the 'Select another folder...' entry that opens the bookmark editor. |
| 344 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { | 343 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { |
| 345 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), | 344 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), |
| 346 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); | 345 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); |
| 347 } | 346 } |
| 348 | 347 |
| 349 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), | 348 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), |
| 350 folder_combo_model_->node_parent_index()); | 349 folder_combo_model_->node_parent_index()); |
| 351 } | 350 } |
| OLD | NEW |