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

Unified Diff: views/widget/wm_ipc.cc

Issue 8604012: move chromeos bubble setup code to window.cc (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: move functionality of wm ipc out of browser so that views/bubble can use it. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« ui/views/bubble/bubble_delegate.h ('K') | « views/widget/wm_ipc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/wm_ipc.cc
diff --git a/chrome/browser/chromeos/legacy_window_manager/wm_ipc.cc b/views/widget/wm_ipc.cc
similarity index 85%
copy from chrome/browser/chromeos/legacy_window_manager/wm_ipc.cc
copy to views/widget/wm_ipc.cc
index d8001597528256f37ab4b25ed02f542c6ad8ef73..413a9dadfba1828eee7e0bbee15a1d354c3f696f 100644
--- a/chrome/browser/chromeos/legacy_window_manager/wm_ipc.cc
+++ b/views/widget/wm_ipc.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h"
+#include "views/widget/wm_ipc.h"
#include <gdk/gdkx.h>
extern "C" {
@@ -13,14 +13,14 @@ extern "C" {
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "content/public/browser/notification_service.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/rect.h"
using std::map;
using std::string;
+namespace views {
+
namespace chromeos {
namespace {
@@ -98,7 +98,7 @@ string WmIpc::GetAtomName(AtomType type) const {
}
bool WmIpc::SetWindowType(GtkWidget* widget,
- WmIpcWindowType type,
+ ::chromeos::WmIpcWindowType type,
const std::vector<int>* params) {
std::vector<int> values;
values.push_back(type);
@@ -109,8 +109,8 @@ bool WmIpc::SetWindowType(GtkWidget* widget,
atom, atom, values);
}
-WmIpcWindowType WmIpc::GetWindowType(GtkWidget* widget,
- std::vector<int>* params) {
+::chromeos::WmIpcWindowType WmIpc::GetWindowType(GtkWidget* widget,
+ std::vector<int>* params) {
std::vector<int> properties;
if (ui::GetIntArrayProperty(
ui::GetX11WindowFromGtkWidget(widget),
@@ -121,9 +121,9 @@ WmIpcWindowType WmIpc::GetWindowType(GtkWidget* widget,
params->clear();
params->insert(params->begin(), properties.begin() + 1, properties.end());
}
- return static_cast<WmIpcWindowType>(type);
+ return static_cast< ::chromeos::WmIpcWindowType>(type);
} else {
- return WM_IPC_WINDOW_UNKNOWN;
+ return ::chromeos::WM_IPC_WINDOW_UNKNOWN;
}
}
@@ -182,7 +182,7 @@ bool WmIpc::DecodeMessage(const GdkEventClient& event, Message* msg) {
return false;
}
- msg->set_type(static_cast<WmIpcMessageType>(event.data.l[0]));
+ msg->set_type(static_cast< ::chromeos::WmIpcMessageType>(event.data.l[0]));
if (msg->type() < 0) {
DLOG(WARNING) << "Ignoring ClientEventMessage with invalid message "
<< "type " << msg->type();
@@ -210,14 +210,6 @@ void WmIpc::HandleNonChromeClientMessageEvent(const GdkEventClient& event) {
}
}
-void WmIpc::HandleRootWindowPropertyEvent(const GdkEventProperty& event) {
- static GdkAtom layout_mode_gdk_atom =
- gdk_x11_xatom_to_atom(type_to_atom_[ATOM_CHROME_LAYOUT_MODE]);
-
- if (event.atom == layout_mode_gdk_atom)
- FetchLayoutModeProperty();
-}
-
void WmIpc::SetLoggedInProperty(bool logged_in) {
std::vector<int> values;
values.push_back(static_cast<int>(logged_in));
@@ -239,15 +231,14 @@ void WmIpc::SetStatusBoundsProperty(GtkWidget* widget,
}
void WmIpc::NotifyAboutSignout() {
- Message msg(chromeos::WM_IPC_MESSAGE_WM_NOTIFY_SIGNING_OUT);
+ Message msg(::chromeos::WM_IPC_MESSAGE_WM_NOTIFY_SIGNING_OUT);
SendMessage(msg);
XFlush(ui::GetXDisplay());
}
WmIpc::WmIpc()
: wm_message_atom_(0),
- wm_(0),
- layout_mode_(WM_IPC_LAYOUT_MAXIMIZED) {
+ wm_(0) {
scoped_array<char*> names(new char*[kNumAtoms]);
scoped_array<Atom> atoms(new Atom[kNumAtoms]);
@@ -277,9 +268,7 @@ WmIpc::WmIpc()
root,
static_cast<GdkEventMask>(
event_mask | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK));
-
InitWmInfo();
- FetchLayoutModeProperty();
}
WmIpc::~WmIpc() {}
@@ -288,7 +277,7 @@ void WmIpc::InitWmInfo() {
wm_ = XGetSelectionOwner(ui::GetXDisplay(), type_to_atom_[ATOM_WM_S0]);
// Let the window manager know which version of the IPC messages we support.
- Message msg(chromeos::WM_IPC_MESSAGE_WM_NOTIFY_IPC_VERSION);
+ Message msg(::chromeos::WM_IPC_MESSAGE_WM_NOTIFY_IPC_VERSION);
// TODO: The version number is the latest listed in wm_ipc.h --
// ideally, once this header is shared between Chrome and the Chrome OS window
// manager, we'll just define the version statically in the header.
@@ -296,20 +285,6 @@ void WmIpc::InitWmInfo() {
SendMessage(msg);
}
-void WmIpc::FetchLayoutModeProperty() {
- int value = 0;
- if (ui::GetIntProperty(
- gdk_x11_get_default_root_xwindow(),
- GetAtomName(ATOM_CHROME_LAYOUT_MODE),
- &value)) {
- layout_mode_ = static_cast<WmIpcLayoutMode>(value);
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_LAYOUT_MODE_CHANGED,
- content::Source<WmIpc>(this),
- content::Details<WmIpcLayoutMode>(&layout_mode_));
- } else {
- DLOG(WARNING) << "Missing _CHROME_LAYOUT_MODE property on root window";
- }
-}
-
} // namespace chromeos
+
+} // namespace views
« ui/views/bubble/bubble_delegate.h ('K') | « views/widget/wm_ipc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698