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

Side by Side Diff: chrome/browser/gtk/browser_titlebar.cc

Issue 5711001: Add a new GetInstance() method for remaining files with singleton classes under chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gtk/browser_titlebar.h" 5 #include "chrome/browser/gtk/browser_titlebar.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_spy_frame_, 300 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_spy_frame_,
301 FALSE, FALSE, 0); 301 FALSE, FALSE, 0);
302 } 302 }
303 titlebar_right_buttons_vbox_ = gtk_vbox_new(FALSE, 0); 303 titlebar_right_buttons_vbox_ = gtk_vbox_new(FALSE, 0);
304 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_buttons_vbox_, 304 gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_buttons_vbox_,
305 FALSE, FALSE, 0); 305 FALSE, FALSE, 0);
306 306
307 #if defined(USE_GCONF) 307 #if defined(USE_GCONF)
308 // Either read the gconf database and register for updates (on GNOME), or use 308 // Either read the gconf database and register for updates (on GNOME), or use
309 // the default value (anywhere else). 309 // the default value (anywhere else).
310 Singleton<GConfTitlebarListener>()->SetTitlebarButtons(this); 310 GConfTitlebarListener::GetInstance()->SetTitlebarButtons(this);
311 #else 311 #else
312 BuildButtons(kDefaultButtonString); 312 BuildButtons(kDefaultButtonString);
313 #endif 313 #endif
314 314
315 // We use an alignment to control the titlebar height. 315 // We use an alignment to control the titlebar height.
316 titlebar_alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 316 titlebar_alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
317 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) { 317 if (browser_window_->browser()->type() == Browser::TYPE_NORMAL) {
318 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_alignment_, TRUE, 318 gtk_box_pack_start(GTK_BOX(container_hbox_), titlebar_alignment_, TRUE,
319 TRUE, 0); 319 TRUE, 0);
320 320
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 367
368 gtk_widget_show_all(container_); 368 gtk_widget_show_all(container_);
369 369
370 ActiveWindowWatcherX::AddObserver(this); 370 ActiveWindowWatcherX::AddObserver(this);
371 } 371 }
372 372
373 BrowserTitlebar::~BrowserTitlebar() { 373 BrowserTitlebar::~BrowserTitlebar() {
374 ActiveWindowWatcherX::RemoveObserver(this); 374 ActiveWindowWatcherX::RemoveObserver(this);
375 #if defined(USE_GCONF) 375 #if defined(USE_GCONF)
376 Singleton<GConfTitlebarListener>()->RemoveObserver(this); 376 GConfTitlebarListener::GetInstance()->RemoveObserver(this);
377 #endif 377 #endif
378 } 378 }
379 379
380 void BrowserTitlebar::BuildButtons(const std::string& button_string) { 380 void BrowserTitlebar::BuildButtons(const std::string& button_string) {
381 // Clear out all previous data. 381 // Clear out all previous data.
382 close_button_.reset(); 382 close_button_.reset();
383 restore_button_.reset(); 383 restore_button_.reset();
384 maximize_button_.reset(); 384 maximize_button_.reset();
385 minimize_button_.reset(); 385 minimize_button_.reset();
386 gtk_util::RemoveAllChildren(titlebar_left_buttons_vbox_); 386 gtk_util::RemoveAllChildren(titlebar_left_buttons_vbox_);
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 !prefs->GetBoolean(prefs::kUseCustomChromeFrame)); 842 !prefs->GetBoolean(prefs::kUseCustomChromeFrame));
843 return; 843 return;
844 } 844 }
845 845
846 browser_window_->browser()->ExecuteCommand(command_id); 846 browser_window_->browser()->ExecuteCommand(command_id);
847 } 847 }
848 848
849 bool BrowserTitlebar::GetAcceleratorForCommandId( 849 bool BrowserTitlebar::GetAcceleratorForCommandId(
850 int command_id, menus::Accelerator* accelerator) { 850 int command_id, menus::Accelerator* accelerator) {
851 const menus::AcceleratorGtk* accelerator_gtk = 851 const menus::AcceleratorGtk* accelerator_gtk =
852 Singleton<AcceleratorsGtk>()->GetPrimaryAcceleratorForCommand( 852 AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand(
853 command_id); 853 command_id);
854 if (accelerator_gtk) 854 if (accelerator_gtk)
855 *accelerator = *accelerator_gtk; 855 *accelerator = *accelerator_gtk;
856 return accelerator_gtk; 856 return accelerator_gtk;
857 } 857 }
858 858
859 void BrowserTitlebar::Observe(NotificationType type, 859 void BrowserTitlebar::Observe(NotificationType type,
860 const NotificationSource& source, 860 const NotificationSource& source,
861 const NotificationDetails& details) { 861 const NotificationDetails& details) {
862 switch (type.value) { 862 switch (type.value) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 menus::SimpleMenuModel::Delegate* delegate) 939 menus::SimpleMenuModel::Delegate* delegate)
940 : SimpleMenuModel(delegate) { 940 : SimpleMenuModel(delegate) {
941 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); 941 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB);
942 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 942 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
943 AddSeparator(); 943 AddSeparator();
944 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); 944 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
945 AddSeparator(); 945 AddSeparator();
946 AddCheckItemWithStringId(kShowWindowDecorationsCommand, 946 AddCheckItemWithStringId(kShowWindowDecorationsCommand,
947 IDS_SHOW_WINDOW_DECORATIONS_MENU); 947 IDS_SHOW_WINDOW_DECORATIONS_MENU);
948 } 948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698