diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/views/profile_menu_model.cc | 46 | ||||
-rw-r--r-- | chrome/browser/ui/views/profile_menu_model.h | 50 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 |
3 files changed, 98 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/profile_menu_model.cc b/chrome/browser/ui/views/profile_menu_model.cc new file mode 100644 index 0000000..da2021a --- /dev/null +++ b/chrome/browser/ui/views/profile_menu_model.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/profile_menu_model.h" + +#include "grit/generated_resources.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/models/accelerator.h" +#include "ui/base/models/simple_menu_model.h" +#include "views/controls/menu/menu_2.h" + +namespace views { + +ProfileMenuModel::ProfileMenuModel() + : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)) { + AddItem(0, l10n_util::GetStringUTF16( + IDS_PROFILES_CREATE_NEW_PROFILE_OPTION)); + menu_.reset(new views::Menu2(this)); +} + +ProfileMenuModel::~ProfileMenuModel() { +} + +void ProfileMenuModel::RunMenuAt(const gfx::Point& point) { + menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPRIGHT); +} + +bool ProfileMenuModel::IsCommandIdChecked(int command_id) const { + return false; +} + +bool ProfileMenuModel::IsCommandIdEnabled(int command_id) const { + return false; +} + +bool ProfileMenuModel::GetAcceleratorForCommandId(int command_id, + ui::Accelerator* accelerator) { + return false; +} + +void ProfileMenuModel::ExecuteCommand(int command_id) { + NOTIMPLEMENTED(); +} + +} // namespace views diff --git a/chrome/browser/ui/views/profile_menu_model.h b/chrome/browser/ui/views/profile_menu_model.h new file mode 100644 index 0000000..9f2bc74 --- /dev/null +++ b/chrome/browser/ui/views/profile_menu_model.h @@ -0,0 +1,50 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_MODEL_H_ +#define CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_MODEL_H_ +#pragma once + +#include "ui/base/models/simple_menu_model.h" +#include "ui/gfx/point.h" + +namespace ui { +class Accelerator; +} + +namespace views { +class Menu2; + +// ProfileMenuModel +// +// Menu for the multi-profile button displayed on the browser frame when the +// user is in a multi-profile-enabled account. Stub for now. TODO(mirandac): +// enable and fill in as part of multi-profile work. + +class ProfileMenuModel : public ui::SimpleMenuModel, + public ui::SimpleMenuModel::Delegate { + public: + ProfileMenuModel(); + virtual ~ProfileMenuModel(); + + void RunMenuAt(const gfx::Point& point); + + // ui::SimpleMenuModel::Delegate implementation + virtual bool IsCommandIdChecked(int command_id) const; + virtual bool IsCommandIdEnabled(int command_id) const; + virtual bool GetAcceleratorForCommandId(int command_id, + ui::Accelerator* accelerator); + virtual void ExecuteCommand(int command_id); + + private: + scoped_ptr<views::Menu2> menu_; + + DISALLOW_COPY_AND_ASSIGN(ProfileMenuModel); +}; + +} // namespace views + +#endif // CHROME_BROWSER_UI_VIEWS_PROFILE_MENU_MODEL_H_ + + diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 6471de6..39314b9 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -3105,6 +3105,8 @@ 'browser/ui/views/page_info_bubble_view.h', 'browser/ui/views/pinned_contents_info_bubble.cc', 'browser/ui/views/pinned_contents_info_bubble.h', + 'browser/ui/views/profile_menu_model.h', + 'browser/ui/views/profile_menu_model.cc', 'browser/ui/views/reload_button.cc', 'browser/ui/views/reload_button.h', 'browser/ui/views/repost_form_warning_view.cc', |