summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/browser_window_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/gtk/browser_window_gtk.cc')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc69
1 files changed, 69 insertions, 0 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index d4e2e00..c760d11 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -68,8 +68,13 @@
#include "grit/theme_resources.h"
#if defined(OS_CHROMEOS)
+#include "chrome/browser/views/compact_navigation_bar.h"
+#include "chrome/browser/views/frame/status_area_view.h"
#include "chrome/browser/views/panel_controller.h"
#include "chrome/browser/views/tabs/tab_overview_types.h"
+#include "views/widget/widget_gtk.h"
+
+#define COMPACT_NAV_BAR
#endif
namespace {
@@ -409,6 +414,8 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser)
#if defined(OS_CHROMEOS)
drag_active_(false),
panel_controller_(NULL),
+ compact_navigation_bar_(NULL),
+ status_area_(NULL),
#endif
frame_cursor_(NULL),
is_active_(true),
@@ -1326,8 +1333,29 @@ void BrowserWindowGtk::InitWidgets() {
// Build the titlebar (tabstrip + header space + min/max/close buttons).
titlebar_.reset(new BrowserTitlebar(this, window_));
+
+#if defined(OS_CHROMEOS) && defined(COMPACT_NAV_BAR)
+ // Make a box that we'll later insert the compact navigation bar into. The
+ // tabstrip must go into an hbox with our box so that they can get arranged
+ // horizontally.
+ GtkWidget* titlebar_hbox = gtk_hbox_new(FALSE, 0);
+ GtkWidget* navbar_hbox = gtk_hbox_new(FALSE, 0);
+ GtkWidget* status_hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(navbar_hbox);
+ gtk_widget_show(titlebar_hbox);
+ gtk_widget_show(status_hbox);
+ gtk_box_pack_start(GTK_BOX(titlebar_hbox), navbar_hbox, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(titlebar_hbox), titlebar_->widget(), TRUE, TRUE,
+ 0);
+ gtk_box_pack_start(GTK_BOX(titlebar_hbox), status_hbox, FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(window_vbox), titlebar_hbox, FALSE, FALSE, 0);
+
+#else
+ // Insert the tabstrip into the window.
gtk_box_pack_start(GTK_BOX(window_vbox), titlebar_->widget(), FALSE, FALSE,
0);
+#endif // OS_CHROMEOS
// The content_vbox_ surrounds the "content": toolbar+bookmarks bar+page.
content_vbox_ = gtk_vbox_new(FALSE, 0);
@@ -1336,6 +1364,9 @@ void BrowserWindowGtk::InitWidgets() {
toolbar_.reset(new BrowserToolbarGtk(browser_.get(), this));
toolbar_->Init(browser_->profile(), window_);
toolbar_->AddToolbarToBox(content_vbox_);
+#if defined(OS_CHROMEOS) && defined(COMPACT_NAV_BAR)
+ gtk_widget_hide(toolbar_->widget());
+#endif
bookmark_bar_.reset(new BookmarkBarGtk(browser_->profile(), browser_.get(),
this));
@@ -1405,6 +1436,44 @@ void BrowserWindowGtk::InitWidgets() {
gtk_container_add(GTK_CONTAINER(window_), window_container_);
gtk_widget_show(window_container_);
browser_->tabstrip_model()->AddObserver(this);
+
+#if defined(OS_CHROMEOS) && defined(COMPACT_NAV_BAR)
+ // Create the compact navigation bar. This must be done after adding
+ // everything to the window since it's done in Views, which expects to call
+ // realize (requiring a window) in the Init function.
+ views::WidgetGtk* clb_widget =
+ new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD);
+ clb_widget->set_delete_on_destroy(true);
+ // Must initialize with a NULL parent since the widget will assume the parent
+ // is also a WidgetGtk. Then we can parent the native widget afterwards.
+ clb_widget->Init(NULL, gfx::Rect(0, 0, 100, 30));
+ gtk_widget_reparent(clb_widget->GetNativeView(), navbar_hbox);
+
+ compact_navigation_bar_ = new CompactNavigationBar(browser_.get());
+
+ clb_widget->SetContentsView(compact_navigation_bar_);
+ compact_navigation_bar_->Init();
+
+ // Create the status area.
+ views::WidgetGtk* status_widget =
+ new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD);
+ status_widget->set_delete_on_destroy(true);
+ status_widget->Init(NULL, gfx::Rect(0, 0, 100, 30));
+ gtk_widget_reparent(status_widget->GetNativeView(), status_hbox);
+ status_area_ = new StatusAreaView(browser());
+ status_widget->SetContentsView(status_area_);
+ status_area_->Init();
+
+ // Must be after Init.
+ gtk_widget_set_size_request(clb_widget->GetNativeView(),
+ compact_navigation_bar_->GetPreferredSize().width(), 20);
+ gfx::Size status_area_size = status_area_->GetPreferredSize();
+ gtk_widget_set_size_request(status_widget->GetNativeView(),
+ status_area_size.width(),
+ status_area_size.height());
+ clb_widget->Show();
+ status_widget->Show();
+#endif // OS_CHROMEOS
}
void BrowserWindowGtk::SetBackgroundColor() {