Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_window_gtk.h" | 5 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1269 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); | 1269 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 1270 if (!is_kiosk) { | 1270 if (!is_kiosk) { |
| 1271 fullscreen_exit_bubble_.reset(new FullscreenExitBubbleGtk( | 1271 fullscreen_exit_bubble_.reset(new FullscreenExitBubbleGtk( |
| 1272 GTK_FLOATING_CONTAINER(render_area_floating_container_))); | 1272 GTK_FLOATING_CONTAINER(render_area_floating_container_))); |
| 1273 } | 1273 } |
| 1274 gtk_widget_hide(toolbar_border_); | 1274 gtk_widget_hide(toolbar_border_); |
| 1275 } else { | 1275 } else { |
| 1276 fullscreen_exit_bubble_.reset(); | 1276 fullscreen_exit_bubble_.reset(); |
| 1277 UpdateCustomFrame(); | 1277 UpdateCustomFrame(); |
| 1278 ShowSupportedWindowFeatures(); | 1278 ShowSupportedWindowFeatures(); |
| 1279 | |
| 1280 gtk_widget_show(toolbar_border_); | |
| 1281 gdk_window_lower(toolbar_border_->window); | |
| 1282 } | 1279 } |
| 1283 } | 1280 } |
| 1284 | 1281 |
| 1285 UpdateWindowShape(bounds_.width(), bounds_.height()); | 1282 UpdateWindowShape(bounds_.width(), bounds_.height()); |
| 1286 SaveWindowPosition(); | 1283 SaveWindowPosition(); |
| 1287 } | 1284 } |
| 1288 | 1285 |
| 1289 void BrowserWindowGtk::UnMaximize() { | 1286 void BrowserWindowGtk::UnMaximize() { |
| 1290 // It can happen that you end up with a window whose restore size is the same | 1287 // It can happen that you end up with a window whose restore size is the same |
| 1291 // as the size of the screen, so unmaximizing it merely remaximizes it due to | 1288 // as the size of the screen, so unmaximizing it merely remaximizes it due to |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1477 render_area_vbox_ = gtk_vbox_new(FALSE, 0); | 1474 render_area_vbox_ = gtk_vbox_new(FALSE, 0); |
| 1478 gtk_widget_set_name(render_area_vbox_, "chrome-render-area-vbox"); | 1475 gtk_widget_set_name(render_area_vbox_, "chrome-render-area-vbox"); |
| 1479 render_area_floating_container_ = gtk_floating_container_new(); | 1476 render_area_floating_container_ = gtk_floating_container_new(); |
| 1480 gtk_container_add(GTK_CONTAINER(render_area_floating_container_), | 1477 gtk_container_add(GTK_CONTAINER(render_area_floating_container_), |
| 1481 render_area_vbox_); | 1478 render_area_vbox_); |
| 1482 | 1479 |
| 1483 toolbar_border_ = gtk_event_box_new(); | 1480 toolbar_border_ = gtk_event_box_new(); |
| 1484 gtk_box_pack_start(GTK_BOX(render_area_vbox_), | 1481 gtk_box_pack_start(GTK_BOX(render_area_vbox_), |
| 1485 toolbar_border_, FALSE, FALSE, 0); | 1482 toolbar_border_, FALSE, FALSE, 0); |
| 1486 gtk_widget_set_size_request(toolbar_border_, -1, 1); | 1483 gtk_widget_set_size_request(toolbar_border_, -1, 1); |
| 1487 gtk_widget_show(toolbar_border_); | 1484 gtk_widget_set_no_show_all(toolbar_border_, TRUE); |
| 1485 | |
| 1486 if (IsToolbarSupported()) | |
| 1487 gtk_widget_show(toolbar_border_); | |
| 1488 | 1488 |
| 1489 infobar_container_.reset(new InfoBarContainerGtk(browser_->profile())); | 1489 infobar_container_.reset(new InfoBarContainerGtk(browser_->profile())); |
| 1490 gtk_box_pack_start(GTK_BOX(render_area_vbox_), | 1490 gtk_box_pack_start(GTK_BOX(render_area_vbox_), |
| 1491 infobar_container_->widget(), | 1491 infobar_container_->widget(), |
| 1492 FALSE, FALSE, 0); | 1492 FALSE, FALSE, 0); |
| 1493 | 1493 |
| 1494 status_bubble_.reset(new StatusBubbleGtk(browser_->profile())); | 1494 status_bubble_.reset(new StatusBubbleGtk(browser_->profile())); |
| 1495 | 1495 |
| 1496 contents_container_.reset(new TabContentsContainerGtk(status_bubble_.get())); | 1496 contents_container_.reset(new TabContentsContainerGtk(status_bubble_.get())); |
| 1497 devtools_container_.reset(new TabContentsContainerGtk(NULL)); | 1497 devtools_container_.reset(new TabContentsContainerGtk(NULL)); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1572 // When the cursor is over the divider, GTK+ normally lightens the background | 1572 // When the cursor is over the divider, GTK+ normally lightens the background |
| 1573 // color by 1.3 (see LIGHTNESS_MULT in gtkstyle.c). Since we're setting the | 1573 // color by 1.3 (see LIGHTNESS_MULT in gtkstyle.c). Since we're setting the |
| 1574 // color, override the prelight also. | 1574 // color, override the prelight also. |
| 1575 color_utils::HSL hsl = { -1, 0.5, 0.65 }; | 1575 color_utils::HSL hsl = { -1, 0.5, 0.65 }; |
| 1576 SkColor frame_prelight_color = color_utils::HSLShift(frame_color, hsl); | 1576 SkColor frame_prelight_color = color_utils::HSLShift(frame_color, hsl); |
| 1577 GdkColor frame_prelight_color_gdk = SkColorToGdkColor(frame_prelight_color); | 1577 GdkColor frame_prelight_color_gdk = SkColorToGdkColor(frame_prelight_color); |
| 1578 gtk_widget_modify_bg(contents_split_, GTK_STATE_PRELIGHT, | 1578 gtk_widget_modify_bg(contents_split_, GTK_STATE_PRELIGHT, |
| 1579 &frame_prelight_color_gdk); | 1579 &frame_prelight_color_gdk); |
| 1580 | 1580 |
| 1581 GdkColor border_color = theme_provider->GetBorderColor(); | 1581 GdkColor border_color = theme_provider->GetBorderColor(); |
| 1582 | |
|
Evan Martin
2010/04/06 01:35:39
intentional?
Evan Stade
2010/04/06 01:39:40
no
| |
| 1582 gtk_widget_modify_bg(toolbar_border_, GTK_STATE_NORMAL, &border_color); | 1583 gtk_widget_modify_bg(toolbar_border_, GTK_STATE_NORMAL, &border_color); |
| 1583 } | 1584 } |
| 1584 | 1585 |
| 1585 void BrowserWindowGtk::OnSizeChanged(int width, int height) { | 1586 void BrowserWindowGtk::OnSizeChanged(int width, int height) { |
| 1586 UpdateWindowShape(width, height); | 1587 UpdateWindowShape(width, height); |
| 1587 } | 1588 } |
| 1588 | 1589 |
| 1589 void BrowserWindowGtk::UpdateWindowShape(int width, int height) { | 1590 void BrowserWindowGtk::UpdateWindowShape(int width, int height) { |
| 1590 if (UseCustomFrame() && !IsFullscreen() && !IsMaximized()) { | 1591 if (UseCustomFrame() && !IsFullscreen() && !IsMaximized()) { |
| 1591 // Make the top corners rounded. We set a mask that includes most of the | 1592 // Make the top corners rounded. We set a mask that includes most of the |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1923 browser_->ExecuteCommand(id); | 1924 browser_->ExecuteCommand(id); |
| 1924 return true; | 1925 return true; |
| 1925 } | 1926 } |
| 1926 return false; | 1927 return false; |
| 1927 } | 1928 } |
| 1928 | 1929 |
| 1929 void BrowserWindowGtk::ShowSupportedWindowFeatures() { | 1930 void BrowserWindowGtk::ShowSupportedWindowFeatures() { |
| 1930 if (IsTabStripSupported()) | 1931 if (IsTabStripSupported()) |
| 1931 tabstrip_->Show(); | 1932 tabstrip_->Show(); |
| 1932 | 1933 |
| 1933 if (IsToolbarSupported()) | 1934 if (IsToolbarSupported()) { |
| 1934 toolbar_->Show(); | 1935 toolbar_->Show(); |
| 1936 gtk_widget_show(toolbar_border_); | |
| 1937 gdk_window_lower(toolbar_border_->window); | |
| 1938 } | |
| 1935 | 1939 |
| 1936 if (IsBookmarkBarSupported()) | 1940 if (IsBookmarkBarSupported()) |
| 1937 MaybeShowBookmarkBar(browser_->GetSelectedTabContents(), false); | 1941 MaybeShowBookmarkBar(browser_->GetSelectedTabContents(), false); |
| 1938 } | 1942 } |
| 1939 | 1943 |
| 1940 void BrowserWindowGtk::HideUnsupportedWindowFeatures() { | 1944 void BrowserWindowGtk::HideUnsupportedWindowFeatures() { |
| 1941 if (!IsTabStripSupported()) | 1945 if (!IsTabStripSupported()) |
| 1942 tabstrip_->Hide(); | 1946 tabstrip_->Hide(); |
| 1943 | 1947 |
| 1944 if (!IsToolbarSupported()) | 1948 if (!IsToolbarSupported()) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2059 // are taken from the WMs' source code. | 2063 // are taken from the WMs' source code. |
| 2060 return (wm_name == "Blackbox" || | 2064 return (wm_name == "Blackbox" || |
| 2061 wm_name == "compiz" || | 2065 wm_name == "compiz" || |
| 2062 wm_name == "e16" || // Enlightenment DR16 | 2066 wm_name == "e16" || // Enlightenment DR16 |
| 2063 wm_name == "KWin" || | 2067 wm_name == "KWin" || |
| 2064 wm_name == "Metacity" || | 2068 wm_name == "Metacity" || |
| 2065 wm_name == "Mutter" || | 2069 wm_name == "Mutter" || |
| 2066 wm_name == "Openbox" || | 2070 wm_name == "Openbox" || |
| 2067 wm_name == "Xfwm4"); | 2071 wm_name == "Xfwm4"); |
| 2068 } | 2072 } |
| OLD | NEW |