Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / platform_util_common_linux.cc
blob03481b96c4c92cf26cfc9d829ee25b4444bbc951
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
3 // found in the LICENSE file.
5 #include "chrome/browser/platform_util.h"
7 #include <gtk/gtk.h>
9 namespace platform_util {
11 gfx::NativeWindow GetTopLevel(gfx::NativeView view) {
12 // A detached widget won't have a toplevel window as an ancestor, so we can't
13 // assume that the query for toplevel will return a window.
14 GtkWidget* toplevel = gtk_widget_get_ancestor(view, GTK_TYPE_WINDOW);
15 return GTK_IS_WINDOW(toplevel) ? GTK_WINDOW(toplevel) : NULL;
18 gfx::NativeView GetParent(gfx::NativeView view) {
19 return gtk_widget_get_parent(view);
22 bool IsWindowActive(gfx::NativeWindow window) {
23 return gtk_window_is_active(window);
26 void ActivateWindow(gfx::NativeWindow window) {
27 gtk_window_present(window);
30 bool IsVisible(gfx::NativeView view) {
31 return gtk_widget_get_visible(view);
34 } // namespace platform_util