diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 16:07:45 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 16:07:45 +0000 |
commit | 7e7e96ddb9daf85e680a6240e96fdc288c314b20 (patch) | |
tree | 213f1acf78e7fc8ed0f1e31805a4871c07eeb064 /chrome | |
parent | e52628df9cbac18842a8c7873b05a55a61a249a6 (diff) | |
download | chromium_src-7e7e96ddb9daf85e680a6240e96fdc288c314b20.zip chromium_src-7e7e96ddb9daf85e680a6240e96fdc288c314b20.tar.gz chromium_src-7e7e96ddb9daf85e680a6240e96fdc288c314b20.tar.bz2 |
Retry profile menu model change and clang fixes.
Recommitting http://codereview.chromium.org/6610015/ and http://codereview.chromium.org/6613028/ in one single patch, so Linux shlib is pleased.
BUG=none
TEST=none
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=76952
Review URL: http://codereview.chromium.org/6632003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77139 0039d316-1c4b-4281-b951-d872f2087c98
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', |