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/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // managed for us, so it appears to be only used for the download shelf | 179 // managed for us, so it appears to be only used for the download shelf |
180 // animation. | 180 // animation. |
181 int x = 0; | 181 int x = 0; |
182 int y = 0; | 182 int y = 0; |
183 if (expanded_->window) | 183 if (expanded_->window) |
184 gdk_window_get_origin(expanded_->window, &x, &y); | 184 gdk_window_get_origin(expanded_->window, &x, &y); |
185 out->SetRect(x + expanded_->allocation.x, y + expanded_->allocation.y, | 185 out->SetRect(x + expanded_->allocation.x, y + expanded_->allocation.y, |
186 requested_size_.width(), requested_size_.height()); | 186 requested_size_.width(), requested_size_.height()); |
187 } | 187 } |
188 | 188 |
189 void TabContentsViewGtk::SetPageTitle(const std::wstring& title) { | 189 void TabContentsViewGtk::SetPageTitle(const string16& title) { |
190 // Set the window name to include the page title so it's easier to spot | 190 // Set the window name to include the page title so it's easier to spot |
191 // when debugging (e.g. via xwininfo -tree). | 191 // when debugging (e.g. via xwininfo -tree). |
192 gfx::NativeView content_view = GetContentNativeView(); | 192 gfx::NativeView content_view = GetContentNativeView(); |
193 if (content_view && content_view->window) | 193 if (content_view && content_view->window) |
194 gdk_window_set_title(content_view->window, WideToUTF8(title).c_str()); | 194 gdk_window_set_title(content_view->window, UTF16ToUTF8(title).c_str()); |
195 } | 195 } |
196 | 196 |
197 void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status, | 197 void TabContentsViewGtk::OnTabCrashed(base::TerminationStatus status, |
198 int error_code) { | 198 int error_code) { |
199 if (tab_contents_ != NULL && !sad_tab_.get()) { | 199 if (tab_contents_ != NULL && !sad_tab_.get()) { |
200 sad_tab_.reset(new SadTabGtk( | 200 sad_tab_.reset(new SadTabGtk( |
201 tab_contents_, | 201 tab_contents_, |
202 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? | 202 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ? |
203 SadTabGtk::KILLED : SadTabGtk::CRASHED)); | 203 SadTabGtk::KILLED : SadTabGtk::CRASHED)); |
204 InsertIntoContentArea(sad_tab_->widget()); | 204 InsertIntoContentArea(sad_tab_->widget()); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 g_value_set_int(&value, child_x); | 495 g_value_set_int(&value, child_x); |
496 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 496 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
497 widget, "x", &value); | 497 widget, "x", &value); |
498 | 498 |
499 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 499 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
500 g_value_set_int(&value, child_y); | 500 g_value_set_int(&value, child_y); |
501 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 501 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
502 widget, "y", &value); | 502 widget, "y", &value); |
503 g_value_unset(&value); | 503 g_value_unset(&value); |
504 } | 504 } |
OLD | NEW |