summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/DEPS2
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc5
-rw-r--r--chrome/browser/chromeos/frame/panel_controller.cc16
-rw-r--r--chrome/browser/chromeos/login/background_view.cc3
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc14
-rw-r--r--chrome/browser/chromeos/login/user_controller.cc17
-rw-r--r--chrome/browser/chromeos/login/user_controller.h2
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc3
-rw-r--r--chrome/browser/chromeos/panels/panel_browsertest.cc3
-rw-r--r--chrome/browser/chromeos/wm_ipc.cc19
-rw-r--r--chrome/browser/chromeos/wm_ipc.h202
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.cc10
-rw-r--r--chrome/browser/chromeos/wm_overview_snapshot.cc2
-rw-r--r--chrome/browser/views/browser_bubble_gtk.cc3
-rw-r--r--chrome/browser/views/extensions/extension_popup.cc3
-rw-r--r--chrome/browser/views/info_bubble.cc3
16 files changed, 238 insertions, 69 deletions
diff --git a/chrome/browser/chromeos/DEPS b/chrome/browser/chromeos/DEPS
index 7871d2f..2c963d1 100644
--- a/chrome/browser/chromeos/DEPS
+++ b/chrome/browser/chromeos/DEPS
@@ -1,3 +1,3 @@
include_rules = [
- "+third_party/cros",
+ "+third_party/cros",
]
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 3ddc592..b3925c1 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -32,7 +32,6 @@
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/controls/button/button.h"
#include "views/controls/button/image_button.h"
#include "views/controls/menu/menu_2.h"
@@ -401,7 +400,7 @@ void BrowserView::Init() {
params.push_back(browser()->selected_index());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
- WM_IPC_WINDOW_CHROME_TOPLEVEL,
+ WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
&params);
}
@@ -415,7 +414,7 @@ void BrowserView::Show() {
params.push_back(browser()->selected_index());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
- WM_IPC_WINDOW_CHROME_TOPLEVEL,
+ WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
&params);
}
}
diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc
index 43cbf73..c89dd48 100644
--- a/chrome/browser/chromeos/frame/panel_controller.cc
+++ b/chrome/browser/chromeos/frame/panel_controller.cc
@@ -18,7 +18,6 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
@@ -104,14 +103,14 @@ void PanelController::Init(const gfx::Rect window_bounds) {
WmIpc::instance()->SetWindowType(
title_,
- WM_IPC_WINDOW_CHROME_PANEL_TITLEBAR,
+ WmIpc::WINDOW_TYPE_CHROME_PANEL_TITLEBAR,
NULL);
std::vector<int> type_params;
type_params.push_back(title_xid_);
type_params.push_back(expanded_ ? 1 : 0);
WmIpc::instance()->SetWindowType(
GTK_WIDGET(panel_),
- WM_IPC_WINDOW_CHROME_PANEL_CONTENT,
+ WmIpc::WINDOW_TYPE_CHROME_PANEL_CONTENT,
&type_params);
client_event_handler_id_ = g_signal_connect(
@@ -145,8 +144,7 @@ bool PanelController::TitleMousePressed(const views::MouseEvent& event) {
DCHECK(title_);
// Get the last titlebar width that we saw in a ConfigureNotify event -- we
// need to give drag positions in terms of the top-right corner of the
- // titlebar window. See WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAGGED's declaration
- // for details.
+ // titlebar window. See WM_NOTIFY_PANEL_DRAGGED's declaration for details.
gint title_width = 1;
gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL);
@@ -176,7 +174,7 @@ void PanelController::TitleMouseReleased(
SetState(expanded_ ?
PanelController::MINIMIZED : PanelController::EXPANDED);
} else {
- WmIpc::Message msg(WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAG_COMPLETE);
+ WmIpc::Message msg(WmIpc::Message::WM_NOTIFY_PANEL_DRAG_COMPLETE);
msg.set_param(0, panel_xid_);
WmIpc::instance()->SendMessage(msg);
dragging_ = false;
@@ -184,7 +182,7 @@ void PanelController::TitleMouseReleased(
}
void PanelController::SetState(State state) {
- WmIpc::Message msg(WM_IPC_MESSAGE_WM_SET_PANEL_STATE);
+ WmIpc::Message msg(WmIpc::Message::WM_SET_PANEL_STATE);
msg.set_param(0, panel_xid_);
msg.set_param(1, state == EXPANDED);
WmIpc::instance()->SendMessage(msg);
@@ -210,7 +208,7 @@ bool PanelController::TitleMouseDragged(const views::MouseEvent& event) {
}
}
if (dragging_) {
- WmIpc::Message msg(WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAGGED);
+ WmIpc::Message msg(WmIpc::Message::WM_NOTIFY_PANEL_DRAGGED);
msg.set_param(0, panel_xid_);
msg.set_param(1, last_motion_event.x_root - mouse_down_offset_x_);
msg.set_param(2, last_motion_event.y_root - mouse_down_offset_y_);
@@ -241,7 +239,7 @@ void PanelController::OnFocusOut() {
bool PanelController::PanelClientEvent(GdkEventClient* event) {
WmIpc::Message msg;
WmIpc::instance()->DecodeMessage(*event, &msg);
- if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_PANEL_STATE) {
+ if (msg.type() == WmIpc::Message::CHROME_NOTIFY_PANEL_STATE) {
bool new_state = msg.param(0);
if (expanded_ != new_state) {
expanded_ = new_state;
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc
index d7d424a..2c2afe8 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/chromeos/status/network_menu_button.h"
#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/wm_ipc.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/screen.h"
#include "views/widget/widget_gtk.h"
@@ -127,7 +126,7 @@ void BackgroundView::UpdateWindowType() {
params.push_back(did_paint_ ? 1 : 0);
WmIpc::instance()->SetWindowType(
GTK_WIDGET(GetNativeWindow()),
- WM_IPC_WINDOW_LOGIN_BACKGROUND,
+ chromeos::WmIpc::WINDOW_TYPE_LOGIN_BACKGROUND,
&params);
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 91f8b8d..ee29b0f 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -97,7 +97,7 @@ void ExistingUserController::Delete() {
void ExistingUserController::ProcessWmMessage(const WmIpc::Message& message,
GdkWindow* window) {
- if (message.type() != WM_IPC_MESSAGE_CHROME_CREATE_GUEST_WINDOW)
+ if (message.type() != WmIpc::Message::CHROME_CREATE_GUEST_WINDOW)
return;
// WizardController takes care of deleting itself when done.
@@ -133,9 +133,10 @@ void ExistingUserController::Login(UserController* source,
UTF16ToUTF8(password)));
// Disable clicking on other windows.
- WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE);
+ chromeos::WmIpc::Message message(
+ chromeos::WmIpc::Message::WM_SET_LOGIN_STATE);
message.set_param(0, 0);
- WmIpc::instance()->SendMessage(message);
+ chromeos::WmIpc::instance()->SendMessage(message);
}
void ExistingUserController::OnLoginFailure(const std::string& error) {
@@ -146,9 +147,10 @@ void ExistingUserController::OnLoginFailure(const std::string& error) {
controllers_[index_of_view_logging_in_]->SetPasswordEnabled(true);
// Reenable clicking on other windows.
- WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE);
+ chromeos::WmIpc::Message message(
+ chromeos::WmIpc::Message::WM_SET_LOGIN_STATE);
message.set_param(0, 1);
- WmIpc::instance()->SendMessage(message);
+ chromeos::WmIpc::instance()->SendMessage(message);
}
void ExistingUserController::OnLoginSuccess(const std::string& username,
@@ -158,7 +160,7 @@ void ExistingUserController::OnLoginSuccess(const std::string& username,
background_window_->Close();
- LoginUtils::Get()->CompleteLogin(username, credentials);
+ chromeos::LoginUtils::Get()->CompleteLogin(username, credentials);
// Delay deletion as we're on the stack.
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc
index a833492..972f57e 100644
--- a/chrome/browser/chromeos/login/user_controller.cc
+++ b/chrome/browser/chromeos/login/user_controller.cc
@@ -15,7 +15,6 @@
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "third_party/skia/include/core/SkColor.h"
#include "views/background.h"
#include "views/controls/image_view.h"
@@ -111,9 +110,9 @@ void UserController::Init(int index, int total_user_count) {
image_window_ = CreateImageWindow(index);
border_window_ = CreateBorderWindow(index, total_user_count,
controls_height);
- label_window_ = CreateLabelWindow(index, WM_IPC_WINDOW_LOGIN_LABEL);
+ label_window_ = CreateLabelWindow(index, WmIpc::WINDOW_TYPE_LOGIN_LABEL);
unselected_label_window_ =
- CreateLabelWindow(index, WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL);
+ CreateLabelWindow(index, WmIpc::WINDOW_TYPE_LOGIN_UNSELECTED_LABEL);
}
void UserController::SetPasswordEnabled(bool enable) {
@@ -191,7 +190,7 @@ WidgetGtk* UserController::CreateControlsWindow(int index, int* height) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WM_IPC_WINDOW_LOGIN_CONTROLS,
+ WmIpc::WINDOW_TYPE_LOGIN_CONTROLS,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize, pref.height()));
window->Show();
@@ -216,7 +215,7 @@ WidgetGtk* UserController::CreateImageWindow(int index) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WM_IPC_WINDOW_LOGIN_IMAGE,
+ WmIpc::WINDOW_TYPE_LOGIN_IMAGE,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize, kSize));
window->Show();
@@ -237,7 +236,7 @@ WidgetGtk* UserController::CreateBorderWindow(int index,
params.push_back(kPadding);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WM_IPC_WINDOW_LOGIN_BORDER,
+ WmIpc::WINDOW_TYPE_LOGIN_BORDER,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize + kBorderSize * 2,
@@ -248,12 +247,12 @@ WidgetGtk* UserController::CreateBorderWindow(int index,
}
WidgetGtk* UserController::CreateLabelWindow(int index,
- WmIpcWindowType type) {
+ WmIpc::WindowType type) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ?
+ const gfx::Font& font = (type == WmIpc::WINDOW_TYPE_LOGIN_LABEL) ?
rb.GetFont(ResourceBundle::LargeFont).DeriveFont(0, gfx::Font::BOLD) :
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
- int width = (type == WM_IPC_WINDOW_LOGIN_LABEL) ?
+ int width = (type == WmIpc::WINDOW_TYPE_LOGIN_LABEL) ?
kSize : kUnselectedSize;
WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW);
window->MakeTransparent();
diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h
index 859c355..e7c496d 100644
--- a/chrome/browser/chromeos/login/user_controller.h
+++ b/chrome/browser/chromeos/login/user_controller.h
@@ -85,7 +85,7 @@ class UserController : public views::ButtonListener,
views::WidgetGtk* CreateBorderWindow(int index,
int total_user_count,
int controls_height);
- views::WidgetGtk* CreateLabelWindow(int index, WmIpcWindowType type);
+ views::WidgetGtk* CreateLabelWindow(int index, WmIpc::WindowType type);
// Sets specified image with desired size on the image window.
// Does not repaint the window so SchedulePaint is to be called explicitly
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index c78a054..d6e0ee3 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/chromeos/wm_ipc.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#include "views/accelerator.h"
#include "views/painter.h"
#include "views/screen.h"
@@ -208,7 +207,7 @@ void WizardController::Init(const std::string& first_screen_name,
kWizardScreenHeight));
chromeos::WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- chromeos::WM_IPC_WINDOW_LOGIN_GUEST,
+ chromeos::WmIpc::WINDOW_TYPE_LOGIN_GUEST,
NULL);
window->SetContentsView(contents_);
diff --git a/chrome/browser/chromeos/panels/panel_browsertest.cc b/chrome/browser/chromeos/panels/panel_browsertest.cc
index 315860c..4b01924 100644
--- a/chrome/browser/chromeos/panels/panel_browsertest.cc
+++ b/chrome/browser/chromeos/panels/panel_browsertest.cc
@@ -13,7 +13,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
namespace chromeos {
@@ -63,7 +62,7 @@ IN_PROC_BROWSER_TEST_F(PanelTest, PanelOpenSmall) {
// This window type tells the cros window manager to treat the window
// as a panel.
EXPECT_EQ(
- WM_IPC_WINDOW_CHROME_PANEL_CONTENT,
+ WmIpc::WINDOW_TYPE_CHROME_PANEL_CONTENT,
WmIpc::instance()->GetWindowType(
GTK_WIDGET(new_browser->window()->GetNativeHandle()), NULL));
}
diff --git a/chrome/browser/chromeos/wm_ipc.cc b/chrome/browser/chromeos/wm_ipc.cc
index ead38c9..f3e298b 100644
--- a/chrome/browser/chromeos/wm_ipc.cc
+++ b/chrome/browser/chromeos/wm_ipc.cc
@@ -74,7 +74,7 @@ WmIpc* WmIpc::instance() {
}
bool WmIpc::SetWindowType(GtkWidget* widget,
- WmIpcWindowType type,
+ WindowType type,
const std::vector<int>* params) {
std::vector<int> values;
values.push_back(type);
@@ -84,8 +84,8 @@ bool WmIpc::SetWindowType(GtkWidget* widget,
type_to_atom_[ATOM_CHROME_WINDOW_TYPE], values);
}
-WmIpcWindowType WmIpc::GetWindowType(GtkWidget* widget,
- std::vector<int>* params) {
+WmIpc::WindowType WmIpc::GetWindowType(GtkWidget* widget,
+ std::vector<int>* params) {
std::vector<int> properties;
if (x11_util::GetIntArrayProperty(
x11_util::GetX11WindowFromGtkWidget(widget),
@@ -96,9 +96,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<WindowType>(type);
} else {
- return WM_IPC_WINDOW_UNKNOWN;
+ return WINDOW_TYPE_UNKNOWN;
}
}
@@ -123,7 +123,8 @@ void WmIpc::SendMessage(const Message& msg) {
&e);
}
-bool WmIpc::DecodeMessage(const GdkEventClient& event, Message* msg) {
+bool WmIpc::DecodeMessage(const GdkEventClient& event,
+ Message* msg) {
if (wm_message_atom_ != gdk_x11_atom_to_xatom(event.message_type))
return false;
@@ -134,8 +135,8 @@ bool WmIpc::DecodeMessage(const GdkEventClient& event, Message* msg) {
return false;
}
- msg->set_type(static_cast<WmIpcMessageType>(event.data.l[0]));
- if (msg->type() < 0) {
+ msg->set_type(static_cast<Message::Type>(event.data.l[0]));
+ if (msg->type() < 0 || msg->type() >= Message::kNumTypes) {
DLOG(WARNING) << "Ignoring ClientEventMessage with invalid message "
<< "type " << msg->type();
return false;
@@ -250,7 +251,7 @@ void WmIpc::InitWmInfo() {
wm_ = XGetSelectionOwner(x11_util::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(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.
diff --git a/chrome/browser/chromeos/wm_ipc.h b/chrome/browser/chromeos/wm_ipc.h
index 8c4aba5..7df76a29 100644
--- a/chrome/browser/chromeos/wm_ipc.h
+++ b/chrome/browser/chromeos/wm_ipc.h
@@ -12,7 +12,6 @@
#include "base/logging.h"
#include "base/singleton.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
typedef unsigned long Atom;
typedef unsigned long XID;
@@ -38,18 +37,195 @@ class WmIpc {
kNumAtoms,
};
+ enum WindowType {
+ WINDOW_TYPE_UNKNOWN = 0,
+
+ // A top-level Chrome window.
+ // param[0]: The number of tabs currently in this Chrome window.
+ // param[1]: The index of the currently selected tab in this
+ // Chrome window.
+ WINDOW_TYPE_CHROME_TOPLEVEL,
+
+ // Vestiges of the old windows-across-the-bottom overview mode.
+ DEPRECATED_WINDOW_TYPE_CHROME_TAB_SUMMARY,
+ DEPRECATED_WINDOW_TYPE_CHROME_FLOATING_TAB,
+
+ // The contents of a popup window.
+ // param[0]: X ID of associated titlebar, which must be mapped before
+ // its content
+ // param[1]: Initial state for panel (0 is collapsed, 1 is expanded)
+ WINDOW_TYPE_CHROME_PANEL_CONTENT,
+
+ // A small window representing a collapsed panel in the panel bar and
+ // drawn above the panel when it's expanded.
+ WINDOW_TYPE_CHROME_PANEL_TITLEBAR,
+
+ // Vestiges of an earlier UI design.
+ DEPRECATED_WINDOW_TYPE_CREATE_BROWSER_WINDOW,
+
+ // A Chrome info bubble (e.g. the bookmark bubble). These are
+ // transient RGBA windows; we skip the usual transient behavior of
+ // centering them over their owner and omit drawing a drop shadow.
+ WINDOW_TYPE_CHROME_INFO_BUBBLE,
+
+ // A window showing a view of a tab within a Chrome window.
+ // param[0]: X ID of toplevel window that owns it.
+ // param[1]: index of this tab in the toplevel window that owns it.
+ WINDOW_TYPE_CHROME_TAB_SNAPSHOT,
+
+ // The following types are used for the windows that represent a user that
+ // has already logged into the system.
+ //
+ // Visually the BORDER contains the IMAGE and CONTROLS windows, the LABEL
+ // and UNSELECTED_LABEL are placed beneath the BORDER. The LABEL window is
+ // onscreen when the user is selected, otherwise the UNSELECTED_LABEL is
+ // on screen. The GUEST window is used when the user clicks on the entry
+ // that represents the 'guest' user.
+ //
+ // The following parameters are set for these windows (except GUEST and
+ // BACKGROUND):
+ // param[0]: the visual index of the user the window corresponds to.
+ // For example, all windows with an index of 0 occur first,
+ // followed by windows with an index of 1...
+ //
+ // The following additional params are set on the first BORDER window
+ // (BORDER window whose param[0] == 0).
+ // param[1]: the total number of users.
+ // param[2]: size of the unselected image.
+ // param[3]: gap between image and controls.
+ WINDOW_TYPE_LOGIN_BORDER,
+ WINDOW_TYPE_LOGIN_IMAGE,
+ WINDOW_TYPE_LOGIN_CONTROLS,
+ WINDOW_TYPE_LOGIN_LABEL,
+ WINDOW_TYPE_LOGIN_UNSELECTED_LABEL,
+ WINDOW_TYPE_LOGIN_GUEST,
+ WINDOW_TYPE_LOGIN_BACKGROUND,
+
+ kNumWindowTypes,
+ };
+
struct Message {
public:
+ // NOTE: Don't remove values from this enum; it is shared between
+ // Chrome and the window manager.
+ enum Type {
+ UNKNOWN = 0,
+
+ // Vestiges of the old windows-across-the-bottom overview mode.
+ DEPRECATED_CHROME_NOTIFY_FLOATING_TAB_OVER_TAB_SUMMARY,
+ DEPRECATED_CHROME_NOTIFY_FLOATING_TAB_OVER_TOPLEVEL,
+ DEPRECATED_CHROME_SET_TAB_SUMMARY_VISIBILITY,
+
+ // Tell the WM to collapse or expand a panel.
+ // param[0]: X ID of the panel window
+ // param[1]: desired state (0 means collapsed, 1 means expanded)
+ WM_SET_PANEL_STATE,
+
+ // Notify Chrome that the panel state has changed. Sent to the panel
+ // window.
+ // param[0]: new state (0 means collapsed, 1 means expanded)
+ // TODO: Deprecate this; Chrome can just watch for changes to the
+ // _CHROME_STATE property to get the same information.
+ CHROME_NOTIFY_PANEL_STATE,
+
+ // From the old windows-across-the-bottom overview mode.
+ DEPRECATED_WM_MOVE_FLOATING_TAB,
+
+ // Notify the WM that a panel has been dragged.
+ // param[0]: X ID of the panel's content window
+ // param[1]: X coordinate to which the upper-right corner of the
+ // panel's titlebar window was dragged
+ // param[2]: Y coordinate to which the upper-right corner of the
+ // panel's titlebar window was dragged
+ // Note: The point given is actually that of one pixel to the right
+ // of the upper-right corner of the titlebar window. For example, a
+ // no-op move message for a 10-pixel wide titlebar whose upper-left
+ // point is at (0, 0) would contain the X and Y paremeters (10, 0):
+ // in other words, the position of the titlebar's upper-left point
+ // plus its width. This is intended to make both the Chrome and WM
+ // side of things simpler and to avoid some easy-to-make off-by-one
+ // errors.
+ WM_NOTIFY_PANEL_DRAGGED,
+
+ // Notify the WM that the panel drag is complete (that is, the mouse
+ // button has been released).
+ // param[0]: X ID of the panel's content window
+ WM_NOTIFY_PANEL_DRAG_COMPLETE,
+
+ // Deprecated. Send a _NET_ACTIVE_WINDOW client message to focus a
+ // window instead (e.g. using gtk_window_present()).
+ DEPRECATED_WM_FOCUS_WINDOW,
+
+ // Notify Chrome that the layout mode (for example, overview or
+ // active) has changed. Since overview mode can be "cancelled"
+ // (user hits escape to revert), we have an extra parameter to
+ // indicate this.
+ // param[0]: new mode (0 means active mode, 1 means overview mode)
+ // param[1]: was mode cancelled? (0 = no, 1 = yes)
+ CHROME_NOTIFY_LAYOUT_MODE,
+
+ // Deprecated. Instruct the WM to enter overview mode.
+ // param[0]: X ID of the window to show the tab overview for.
+ DEPRECATED_WM_SWITCH_TO_OVERVIEW_MODE,
+
+ // Let the WM know which version of this file Chrome is using. It's
+ // difficult to make changes synchronously to Chrome and the WM (our
+ // build scripts can use a locally-built Chromium, the latest one
+ // from the buildbot, or an older hardcoded version), so it's useful
+ // to be able to maintain compatibility in the WM with versions of
+ // Chrome that exhibit older behavior.
+ //
+ // Chrome should send a message to the WM at startup containing the
+ // latest version from the list below. For backwards compatibility,
+ // the WM assumes version 0 if it doesn't receive a message. Here
+ // are the changes that have been made in successive versions of the
+ // protocol:
+ //
+ // 1: WM_NOTIFY_PANEL_DRAGGED contains the position of the
+ // upper-right, rather than upper-left, corner of of the titlebar
+ // window
+ //
+ // TODO: The latest version should be hardcoded in this file once the
+ // file is being shared between Chrome and the WM so Chrome can just
+ // pull it from there. Better yet, the message could be sent
+ // automatically in WmIpc's c'tor.
+ //
+ // param[0]: version of this protocol currently supported
+ WM_NOTIFY_IPC_VERSION,
+
+ // Notify Chrome when a tab has been selected in the overview.
+ // Sent to the toplevel window associated with the magnified
+ // tab.
+ // param[0]: tab index of newly selected tab.
+ CHROME_NOTIFY_TAB_SELECT,
+
+ // Forces the window manager to hide the login windows.
+ WM_HIDE_LOGIN,
+
+ // Sets whether login is enabled. If true the user can click on any of the
+ // login windows to select one, if false clicks on unselected windows are
+ // ignored. This is used when the user attempts a login to make sure the
+ // user doesn't select another user.
+ //
+ // param[0]: true to enable, false to disable.
+ WM_SET_LOGIN_STATE,
+
+ // Notify chrome when the guest entry is selected and the guest window
+ // hasn't been created yet.
+ CHROME_CREATE_GUEST_WINDOW,
+
+ kNumTypes,
+ };
+
Message() {
- Init(WM_IPC_MESSAGE_UNKNOWN);
+ Init(UNKNOWN);
}
- // WmIpcMessageType is defined in chromeos_wm_ipc_enums.h.
- explicit Message(WmIpcMessageType type) {
+ explicit Message(Type type) {
Init(type);
}
- WmIpcMessageType type() const { return type_; }
- void set_type(WmIpcMessageType type) { type_ = type; }
+ Type type() const { return type_; }
+ void set_type(Type type) { type_ = type; }
inline int max_params() const {
return arraysize(params_);
@@ -67,7 +243,7 @@ class WmIpc {
private:
// Common initialization code shared between constructors.
- void Init(WmIpcMessageType type) {
+ void Init(Type type) {
set_type(type);
for (int i = 0; i < max_params(); ++i) {
set_param(i, 0);
@@ -75,7 +251,7 @@ class WmIpc {
}
// Type of message that was sent.
- WmIpcMessageType type_;
+ Type type_;
// Type-specific data. This is bounded by the number of 32-bit values
// that we can pack into a ClientMessageEvent -- it holds five, but we
@@ -86,19 +262,19 @@ class WmIpc {
// Returns the single instance of WmIpc.
static WmIpc* instance();
- // Get or set a property describing a window's type.
- // WmIpcMessageType is defined in chromeos_wm_ipc_enums.h. Type-specific
- // parameters may also be supplied. The caller is responsible for trapping
+ // Get or set a property describing a window's type. Type-specific
+ // parameters may also be supplied. The caller is responsible for trapping
// errors from the X server.
+ // TODO: Trap these ourselves.
bool SetWindowType(GtkWidget* widget,
- WmIpcWindowType type,
+ WindowType type,
const std::vector<int>* params);
// Gets the type of the window, and any associated parameters. The
// caller is responsible for trapping errors from the X server. If
// the parameters are not interesting to the caller, NULL may be
// passed for |params|.
- WmIpcWindowType GetWindowType(GtkWidget* widget, std::vector<int>* params);
+ WmIpc::WindowType GetWindowType(GtkWidget* widget, std::vector<int>* params);
// Sends a message to the WM.
void SendMessage(const Message& msg);
diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc
index 3722ef4..01a0888 100644
--- a/chrome/browser/chromeos/wm_overview_controller.cc
+++ b/chrome/browser/chromeos/wm_overview_controller.cc
@@ -204,10 +204,10 @@ void BrowserListener::UpdateSelectedIndex(int index) {
// different from what we know before we set them, to avoid extra
// notifications.
std::vector<int> params;
- WmIpcWindowType type = WmIpc::instance()->GetWindowType(
+ WmIpc::WindowType type = WmIpc::instance()->GetWindowType(
GTK_WIDGET(browser_->window()->GetNativeHandle()),
&params);
- DCHECK(type == WM_IPC_WINDOW_CHROME_TOPLEVEL);
+ DCHECK(type == WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL);
if (params.size() > 1) {
if (params[0] == browser_->tab_count() &&
params[0] == index)
@@ -219,7 +219,7 @@ void BrowserListener::UpdateSelectedIndex(int index) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
GTK_WIDGET(browser_->window()->GetNativeHandle()),
- WM_IPC_WINDOW_CHROME_TOPLEVEL,
+ WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
&params);
}
@@ -378,7 +378,7 @@ BrowserView* GetBrowserViewForGdkWindow(GdkWindow* gdk_window) {
void WmOverviewController::ProcessWmMessage(const WmIpc::Message& message,
GdkWindow* window) {
switch (message.type()) {
- case WM_IPC_MESSAGE_CHROME_NOTIFY_LAYOUT_MODE: {
+ case WmIpc::Message::CHROME_NOTIFY_LAYOUT_MODE: {
if (message.param(0) == 0 || BrowserList::size() == 0) {
Hide(message.param(1) != 0);
} else {
@@ -386,7 +386,7 @@ void WmOverviewController::ProcessWmMessage(const WmIpc::Message& message,
}
break;
}
- case WM_IPC_MESSAGE_CHROME_NOTIFY_TAB_SELECT: {
+ case WmIpc::Message::CHROME_NOTIFY_TAB_SELECT: {
BrowserView* browser_window = GetBrowserViewForGdkWindow(window);
// Find out which listener this goes to, and send it there.
for (BrowserListenerVector::iterator i = listeners_.begin();
diff --git a/chrome/browser/chromeos/wm_overview_snapshot.cc b/chrome/browser/chromeos/wm_overview_snapshot.cc
index 3ae6fd0..97c2a8e 100644
--- a/chrome/browser/chromeos/wm_overview_snapshot.cc
+++ b/chrome/browser/chromeos/wm_overview_snapshot.cc
@@ -58,7 +58,7 @@ void WmOverviewSnapshot::UpdateIndex(Browser* browser, int index) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
GetNativeView(),
- WM_IPC_WINDOW_CHROME_TAB_SNAPSHOT,
+ WmIpc::WINDOW_TYPE_CHROME_TAB_SNAPSHOT,
&params);
index_ = index;
}
diff --git a/chrome/browser/views/browser_bubble_gtk.cc b/chrome/browser/views/browser_bubble_gtk.cc
index 63420d2..8fdedb8 100644
--- a/chrome/browser/views/browser_bubble_gtk.cc
+++ b/chrome/browser/views/browser_bubble_gtk.cc
@@ -10,7 +10,6 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#endif
namespace {
@@ -93,7 +92,7 @@ void BrowserBubble::InitPopup() {
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
pop->GetNativeView(),
- chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
+ chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
NULL);
#endif
pop->SetContentsView(view_);
diff --git a/chrome/browser/views/extensions/extension_popup.cc b/chrome/browser/views/extensions/extension_popup.cc
index 3e91205a..6737ac2 100644
--- a/chrome/browser/views/extensions/extension_popup.cc
+++ b/chrome/browser/views/extensions/extension_popup.cc
@@ -28,7 +28,6 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#endif
using views::Widget;
@@ -111,7 +110,7 @@ ExtensionPopup::ExtensionPopup(ExtensionHost* host,
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
border_widget_->GetNativeView(),
- chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
+ chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
NULL);
#endif
border_ = new BubbleBorder;
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index be5174c..8150db9 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -18,7 +18,6 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
-#include "third_party/cros/chromeos_wm_ipc_enums.h"
#endif
// Background color of the bubble.
@@ -210,7 +209,7 @@ void InfoBubble::Init(views::Window* parent,
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
GetNativeView(),
- chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
+ chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
NULL);
#endif
#endif