Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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_utils.h" 18 #include "chrome/browser/bookmarks/bookmark_utils.h"
19 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h" 19 #include "chrome/browser/bookmarks/recently_used_folders_combo_model.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_list.h" 22 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 23 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
24 #include "chrome/browser/ui/gtk/gtk_util.h" 24 #include "chrome/browser/ui/gtk/gtk_util.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "content/browser/user_metrics.h" 26 #include "content/browser/user_metrics.h"
27 #include "content/common/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "ui/base/gtk/gtk_hig_constants.h" 29 #include "ui/base/gtk/gtk_hig_constants.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 31
32 namespace { 32 namespace {
33 33
34 // We basically have a singleton, since a bubble is sort of app-modal. This 34 // We basically have a singleton, since a bubble is sort of app-modal. This
35 // keeps track of the currently open bubble, or NULL if none is open. 35 // keeps track of the currently open bubble, or NULL if none is open.
36 BookmarkBubbleGtk* g_bubble = NULL; 36 BookmarkBubbleGtk* g_bubble = NULL;
37 37
(...skipping 14 matching lines...) Expand all
52 g_bubble = new BookmarkBubbleGtk(anchor, profile, url, newly_bookmarked); 52 g_bubble = new BookmarkBubbleGtk(anchor, profile, url, newly_bookmarked);
53 } 53 }
54 54
55 void BookmarkBubbleGtk::BubbleClosing(BubbleGtk* bubble, 55 void BookmarkBubbleGtk::BubbleClosing(BubbleGtk* bubble,
56 bool closed_by_escape) { 56 bool closed_by_escape) {
57 if (closed_by_escape) { 57 if (closed_by_escape) {
58 remove_bookmark_ = newly_bookmarked_; 58 remove_bookmark_ = newly_bookmarked_;
59 apply_edits_ = false; 59 apply_edits_ = false;
60 } 60 }
61 61
62 NotificationService::current()->Notify( 62 content::NotificationService::current()->Notify(
63 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, 63 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN,
64 content::Source<Profile>(profile_->GetOriginalProfile()), 64 content::Source<Profile>(profile_->GetOriginalProfile()),
65 NotificationService::NoDetails()); 65 content::NotificationService::NoDetails());
66 } 66 }
67 67
68 void BookmarkBubbleGtk::Observe(int type, 68 void BookmarkBubbleGtk::Observe(int type,
69 const content::NotificationSource& source, 69 const content::NotificationSource& source,
70 const content::NotificationDetails& details) { 70 const content::NotificationDetails& details) {
71 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); 71 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED);
72 72
73 if (theme_service_->UsingNativeTheme()) { 73 if (theme_service_->UsingNativeTheme()) {
74 for (std::vector<GtkWidget*>::iterator it = labels_.begin(); 74 for (std::vector<GtkWidget*>::iterator it = labels_.begin();
75 it != labels_.end(); ++it) { 75 it != labels_.end(); ++it) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // We always have nodes + 1 entries in the combo. The last entry will be 339 // We always have nodes + 1 entries in the combo. The last entry will be
340 // the 'Select another folder...' entry that opens the bookmark editor. 340 // the 'Select another folder...' entry that opens the bookmark editor.
341 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { 341 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) {
342 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), 342 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_),
343 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); 343 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str());
344 } 344 }
345 345
346 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), 346 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_),
347 folder_combo_model_->node_parent_index()); 347 folder_combo_model_->node_parent_index());
348 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc ('k') | chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698