summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 17:26:54 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 17:26:54 +0000
commita65b0ba084b3b197f817b88bd21b275e1790a629 (patch)
treed812ccf4b0ce204a8a6feea456338a13e69e61d4
parent2f3b3f26eeb54856f6f3159ae6a51a632d5a9ad2 (diff)
downloadchromium_src-a65b0ba084b3b197f817b88bd21b275e1790a629.zip
chromium_src-a65b0ba084b3b197f817b88bd21b275e1790a629.tar.gz
chromium_src-a65b0ba084b3b197f817b88bd21b275e1790a629.tar.bz2
chromeos: Make Chrome use enums from libcros to talk to WM.
We currently have two copies of these enums, one in Chrome and one in Chrome OS. I'm switching us to have a single copy in the libcros repo. BUG=none TEST=built it Review URL: http://codereview.chromium.org/1811002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45952 0039d316-1c4b-4281-b951-d872f2087c98
-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, 69 insertions, 238 deletions
diff --git a/chrome/browser/chromeos/DEPS b/chrome/browser/chromeos/DEPS
index 2c963d1..7871d2f 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 b3925c1..3ddc592 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -32,6 +32,7 @@
#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"
@@ -400,7 +401,7 @@ void BrowserView::Init() {
params.push_back(browser()->selected_index());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
- WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
+ WM_IPC_WINDOW_CHROME_TOPLEVEL,
&params);
}
@@ -414,7 +415,7 @@ void BrowserView::Show() {
params.push_back(browser()->selected_index());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
- WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
+ WM_IPC_WINDOW_CHROME_TOPLEVEL,
&params);
}
}
diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc
index c89dd48..43cbf73 100644
--- a/chrome/browser/chromeos/frame/panel_controller.cc
+++ b/chrome/browser/chromeos/frame/panel_controller.cc
@@ -18,6 +18,7 @@
#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"
@@ -103,14 +104,14 @@ void PanelController::Init(const gfx::Rect window_bounds) {
WmIpc::instance()->SetWindowType(
title_,
- WmIpc::WINDOW_TYPE_CHROME_PANEL_TITLEBAR,
+ WM_IPC_WINDOW_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_),
- WmIpc::WINDOW_TYPE_CHROME_PANEL_CONTENT,
+ WM_IPC_WINDOW_CHROME_PANEL_CONTENT,
&type_params);
client_event_handler_id_ = g_signal_connect(
@@ -144,7 +145,8 @@ 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_NOTIFY_PANEL_DRAGGED's declaration for details.
+ // titlebar window. See WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAGGED's declaration
+ // for details.
gint title_width = 1;
gtk_window_get_size(GTK_WINDOW(title_), &title_width, NULL);
@@ -174,7 +176,7 @@ void PanelController::TitleMouseReleased(
SetState(expanded_ ?
PanelController::MINIMIZED : PanelController::EXPANDED);
} else {
- WmIpc::Message msg(WmIpc::Message::WM_NOTIFY_PANEL_DRAG_COMPLETE);
+ WmIpc::Message msg(WM_IPC_MESSAGE_WM_NOTIFY_PANEL_DRAG_COMPLETE);
msg.set_param(0, panel_xid_);
WmIpc::instance()->SendMessage(msg);
dragging_ = false;
@@ -182,7 +184,7 @@ void PanelController::TitleMouseReleased(
}
void PanelController::SetState(State state) {
- WmIpc::Message msg(WmIpc::Message::WM_SET_PANEL_STATE);
+ WmIpc::Message msg(WM_IPC_MESSAGE_WM_SET_PANEL_STATE);
msg.set_param(0, panel_xid_);
msg.set_param(1, state == EXPANDED);
WmIpc::instance()->SendMessage(msg);
@@ -208,7 +210,7 @@ bool PanelController::TitleMouseDragged(const views::MouseEvent& event) {
}
}
if (dragging_) {
- WmIpc::Message msg(WmIpc::Message::WM_NOTIFY_PANEL_DRAGGED);
+ WmIpc::Message msg(WM_IPC_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_);
@@ -239,7 +241,7 @@ void PanelController::OnFocusOut() {
bool PanelController::PanelClientEvent(GdkEventClient* event) {
WmIpc::Message msg;
WmIpc::instance()->DecodeMessage(*event, &msg);
- if (msg.type() == WmIpc::Message::CHROME_NOTIFY_PANEL_STATE) {
+ if (msg.type() == WM_IPC_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 2c2afe8..d7d424a 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -11,6 +11,7 @@
#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"
@@ -126,7 +127,7 @@ void BackgroundView::UpdateWindowType() {
params.push_back(did_paint_ ? 1 : 0);
WmIpc::instance()->SetWindowType(
GTK_WIDGET(GetNativeWindow()),
- chromeos::WmIpc::WINDOW_TYPE_LOGIN_BACKGROUND,
+ WM_IPC_WINDOW_LOGIN_BACKGROUND,
&params);
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index ee29b0f..91f8b8d 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() != WmIpc::Message::CHROME_CREATE_GUEST_WINDOW)
+ if (message.type() != WM_IPC_MESSAGE_CHROME_CREATE_GUEST_WINDOW)
return;
// WizardController takes care of deleting itself when done.
@@ -133,10 +133,9 @@ void ExistingUserController::Login(UserController* source,
UTF16ToUTF8(password)));
// Disable clicking on other windows.
- chromeos::WmIpc::Message message(
- chromeos::WmIpc::Message::WM_SET_LOGIN_STATE);
+ WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE);
message.set_param(0, 0);
- chromeos::WmIpc::instance()->SendMessage(message);
+ WmIpc::instance()->SendMessage(message);
}
void ExistingUserController::OnLoginFailure(const std::string& error) {
@@ -147,10 +146,9 @@ void ExistingUserController::OnLoginFailure(const std::string& error) {
controllers_[index_of_view_logging_in_]->SetPasswordEnabled(true);
// Reenable clicking on other windows.
- chromeos::WmIpc::Message message(
- chromeos::WmIpc::Message::WM_SET_LOGIN_STATE);
+ WmIpc::Message message(WM_IPC_MESSAGE_WM_SET_LOGIN_STATE);
message.set_param(0, 1);
- chromeos::WmIpc::instance()->SendMessage(message);
+ WmIpc::instance()->SendMessage(message);
}
void ExistingUserController::OnLoginSuccess(const std::string& username,
@@ -160,7 +158,7 @@ void ExistingUserController::OnLoginSuccess(const std::string& username,
background_window_->Close();
- chromeos::LoginUtils::Get()->CompleteLogin(username, credentials);
+ 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 972f57e..a833492 100644
--- a/chrome/browser/chromeos/login/user_controller.cc
+++ b/chrome/browser/chromeos/login/user_controller.cc
@@ -15,6 +15,7 @@
#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"
@@ -110,9 +111,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, WmIpc::WINDOW_TYPE_LOGIN_LABEL);
+ label_window_ = CreateLabelWindow(index, WM_IPC_WINDOW_LOGIN_LABEL);
unselected_label_window_ =
- CreateLabelWindow(index, WmIpc::WINDOW_TYPE_LOGIN_UNSELECTED_LABEL);
+ CreateLabelWindow(index, WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL);
}
void UserController::SetPasswordEnabled(bool enable) {
@@ -190,7 +191,7 @@ WidgetGtk* UserController::CreateControlsWindow(int index, int* height) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WmIpc::WINDOW_TYPE_LOGIN_CONTROLS,
+ WM_IPC_WINDOW_LOGIN_CONTROLS,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize, pref.height()));
window->Show();
@@ -215,7 +216,7 @@ WidgetGtk* UserController::CreateImageWindow(int index) {
params.push_back(index);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WmIpc::WINDOW_TYPE_LOGIN_IMAGE,
+ WM_IPC_WINDOW_LOGIN_IMAGE,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize, kSize));
window->Show();
@@ -236,7 +237,7 @@ WidgetGtk* UserController::CreateBorderWindow(int index,
params.push_back(kPadding);
WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- WmIpc::WINDOW_TYPE_LOGIN_BORDER,
+ WM_IPC_WINDOW_LOGIN_BORDER,
&params);
window->SetBounds(gfx::Rect(0, 0, kSize + kBorderSize * 2,
@@ -247,12 +248,12 @@ WidgetGtk* UserController::CreateBorderWindow(int index,
}
WidgetGtk* UserController::CreateLabelWindow(int index,
- WmIpc::WindowType type) {
+ WmIpcWindowType type) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- const gfx::Font& font = (type == WmIpc::WINDOW_TYPE_LOGIN_LABEL) ?
+ const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ?
rb.GetFont(ResourceBundle::LargeFont).DeriveFont(0, gfx::Font::BOLD) :
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
- int width = (type == WmIpc::WINDOW_TYPE_LOGIN_LABEL) ?
+ int width = (type == WM_IPC_WINDOW_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 e7c496d..859c355 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, WmIpc::WindowType type);
+ views::WidgetGtk* CreateLabelWindow(int index, WmIpcWindowType 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 d6e0ee3..c78a054 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -26,6 +26,7 @@
#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"
@@ -207,7 +208,7 @@ void WizardController::Init(const std::string& first_screen_name,
kWizardScreenHeight));
chromeos::WmIpc::instance()->SetWindowType(
window->GetNativeView(),
- chromeos::WmIpc::WINDOW_TYPE_LOGIN_GUEST,
+ chromeos::WM_IPC_WINDOW_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 4b01924..315860c 100644
--- a/chrome/browser/chromeos/panels/panel_browsertest.cc
+++ b/chrome/browser/chromeos/panels/panel_browsertest.cc
@@ -13,6 +13,7 @@
#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 {
@@ -62,7 +63,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(
- WmIpc::WINDOW_TYPE_CHROME_PANEL_CONTENT,
+ WM_IPC_WINDOW_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 f3e298b..ead38c9 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,
- WindowType type,
+ WmIpcWindowType 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);
}
-WmIpc::WindowType WmIpc::GetWindowType(GtkWidget* widget,
- std::vector<int>* params) {
+WmIpcWindowType WmIpc::GetWindowType(GtkWidget* widget,
+ std::vector<int>* params) {
std::vector<int> properties;
if (x11_util::GetIntArrayProperty(
x11_util::GetX11WindowFromGtkWidget(widget),
@@ -96,9 +96,9 @@ WmIpc::WindowType WmIpc::GetWindowType(GtkWidget* widget,
params->clear();
params->insert(params->begin(), properties.begin() + 1, properties.end());
}
- return static_cast<WindowType>(type);
+ return static_cast<WmIpcWindowType>(type);
} else {
- return WINDOW_TYPE_UNKNOWN;
+ return WM_IPC_WINDOW_UNKNOWN;
}
}
@@ -123,8 +123,7 @@ 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;
@@ -135,8 +134,8 @@ bool WmIpc::DecodeMessage(const GdkEventClient& event,
return false;
}
- msg->set_type(static_cast<Message::Type>(event.data.l[0]));
- if (msg->type() < 0 || msg->type() >= Message::kNumTypes) {
+ msg->set_type(static_cast<WmIpcMessageType>(event.data.l[0]));
+ if (msg->type() < 0) {
DLOG(WARNING) << "Ignoring ClientEventMessage with invalid message "
<< "type " << msg->type();
return false;
@@ -251,7 +250,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(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.
diff --git a/chrome/browser/chromeos/wm_ipc.h b/chrome/browser/chromeos/wm_ipc.h
index 7df76a29..8c4aba5 100644
--- a/chrome/browser/chromeos/wm_ipc.h
+++ b/chrome/browser/chromeos/wm_ipc.h
@@ -12,6 +12,7 @@
#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;
@@ -37,195 +38,18 @@ 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(UNKNOWN);
+ Init(WM_IPC_MESSAGE_UNKNOWN);
}
- explicit Message(Type type) {
+ // WmIpcMessageType is defined in chromeos_wm_ipc_enums.h.
+ explicit Message(WmIpcMessageType type) {
Init(type);
}
- Type type() const { return type_; }
- void set_type(Type type) { type_ = type; }
+ WmIpcMessageType type() const { return type_; }
+ void set_type(WmIpcMessageType type) { type_ = type; }
inline int max_params() const {
return arraysize(params_);
@@ -243,7 +67,7 @@ class WmIpc {
private:
// Common initialization code shared between constructors.
- void Init(Type type) {
+ void Init(WmIpcMessageType type) {
set_type(type);
for (int i = 0; i < max_params(); ++i) {
set_param(i, 0);
@@ -251,7 +75,7 @@ class WmIpc {
}
// Type of message that was sent.
- Type type_;
+ WmIpcMessageType 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
@@ -262,19 +86,19 @@ class WmIpc {
// Returns the single instance of WmIpc.
static WmIpc* instance();
- // Get or set a property describing a window's type. Type-specific
- // parameters may also be supplied. The caller is responsible for trapping
+ // 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
// errors from the X server.
- // TODO: Trap these ourselves.
bool SetWindowType(GtkWidget* widget,
- WindowType type,
+ WmIpcWindowType 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|.
- WmIpc::WindowType GetWindowType(GtkWidget* widget, std::vector<int>* params);
+ WmIpcWindowType 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 01a0888..3722ef4 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;
- WmIpc::WindowType type = WmIpc::instance()->GetWindowType(
+ WmIpcWindowType type = WmIpc::instance()->GetWindowType(
GTK_WIDGET(browser_->window()->GetNativeHandle()),
&params);
- DCHECK(type == WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL);
+ DCHECK(type == WM_IPC_WINDOW_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()),
- WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL,
+ WM_IPC_WINDOW_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 WmIpc::Message::CHROME_NOTIFY_LAYOUT_MODE: {
+ case WM_IPC_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 WmIpc::Message::CHROME_NOTIFY_TAB_SELECT: {
+ case WM_IPC_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 97c2a8e..3ae6fd0 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(),
- WmIpc::WINDOW_TYPE_CHROME_TAB_SNAPSHOT,
+ WM_IPC_WINDOW_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 8fdedb8..63420d2 100644
--- a/chrome/browser/views/browser_bubble_gtk.cc
+++ b/chrome/browser/views/browser_bubble_gtk.cc
@@ -10,6 +10,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
+#include "third_party/cros/chromeos_wm_ipc_enums.h"
#endif
namespace {
@@ -92,7 +93,7 @@ void BrowserBubble::InitPopup() {
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
pop->GetNativeView(),
- chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
+ chromeos::WM_IPC_WINDOW_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 6737ac2..3e91205a 100644
--- a/chrome/browser/views/extensions/extension_popup.cc
+++ b/chrome/browser/views/extensions/extension_popup.cc
@@ -28,6 +28,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/wm_ipc.h"
+#include "third_party/cros/chromeos_wm_ipc_enums.h"
#endif
using views::Widget;
@@ -110,7 +111,7 @@ ExtensionPopup::ExtensionPopup(ExtensionHost* host,
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
border_widget_->GetNativeView(),
- chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
+ chromeos::WM_IPC_WINDOW_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 8150db9..be5174c 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -18,6 +18,7 @@
#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.
@@ -209,7 +210,7 @@ void InfoBubble::Init(views::Window* parent,
#if defined(OS_CHROMEOS)
chromeos::WmIpc::instance()->SetWindowType(
GetNativeView(),
- chromeos::WmIpc::WINDOW_TYPE_CHROME_INFO_BUBBLE,
+ chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
NULL);
#endif
#endif