Revert the CefMenuModel separator changes added in revision 747.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@749 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-08-29 16:58:40 +00:00
parent 2e83d58814
commit e99d9c86a6
10 changed files with 26 additions and 130 deletions

View File

@ -70,8 +70,7 @@ typedef struct _cef_menu_model_t {
// //
// Add a separator to the menu. Returns true (1) on success. // Add a separator to the menu. Returns true (1) on success.
/// ///
int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self, int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self);
enum cef_menu_separator_type_t type);
// //
// Add an item to the menu. Returns true (1) on success. // Add an item to the menu. Returns true (1) on success.
@ -104,7 +103,7 @@ typedef struct _cef_menu_model_t {
// on success. // on success.
/// ///
int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self, int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self,
int index, enum cef_menu_separator_type_t type); int index);
// //
// Insert an item in the menu at the specified |index|. Returns true (1) on // Insert an item in the menu at the specified |index|. Returns true (1) on
@ -206,12 +205,6 @@ typedef struct _cef_menu_model_t {
enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)( enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)(
struct _cef_menu_model_t* self, int index); struct _cef_menu_model_t* self, int index);
///
// Returns the separator type at the specified |index|.
///
enum cef_menu_separator_type_t (CEF_CALLBACK *get_separator_type_at)(
struct _cef_menu_model_t* self, int index);
/// ///
// Returns the group id for the specified |command_id| or -1 if invalid. // Returns the group id for the specified |command_id| or -1 if invalid.
/// ///

View File

@ -50,7 +50,6 @@
class CefMenuModel : public virtual CefBase { class CefMenuModel : public virtual CefBase {
public: public:
typedef cef_menu_item_type_t MenuItemType; typedef cef_menu_item_type_t MenuItemType;
typedef cef_menu_separator_type_t MenuSeparatorType;
/// ///
// Clears the menu. Returns true on success. // Clears the menu. Returns true on success.
@ -68,7 +67,7 @@ class CefMenuModel : public virtual CefBase {
// Add a separator to the menu. Returns true on success. // Add a separator to the menu. Returns true on success.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool AddSeparator(MenuSeparatorType type) =0; virtual bool AddSeparator() =0;
// //
// Add an item to the menu. Returns true on success. // Add an item to the menu. Returns true on success.
@ -104,7 +103,7 @@ class CefMenuModel : public virtual CefBase {
// success. // success.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) =0; virtual bool InsertSeparatorAt(int index) =0;
// //
// Insert an item in the menu at the specified |index|. Returns true on // Insert an item in the menu at the specified |index|. Returns true on
@ -213,12 +212,6 @@ class CefMenuModel : public virtual CefBase {
/*--cef(default_retval=MENUITEMTYPE_NONE)--*/ /*--cef(default_retval=MENUITEMTYPE_NONE)--*/
virtual MenuItemType GetTypeAt(int index) =0; virtual MenuItemType GetTypeAt(int index) =0;
///
// Returns the separator type at the specified |index|.
///
/*--cef(default_retval=MENUSEPARATORTYPE_NONE)--*/
virtual MenuSeparatorType GetSeparatorTypeAt(int index) =0;
/// ///
// Returns the group id for the specified |command_id| or -1 if invalid. // Returns the group id for the specified |command_id| or -1 if invalid.
/// ///

View File

@ -984,33 +984,6 @@ enum cef_menu_item_type_t {
MENUITEMTYPE_SUBMENU, MENUITEMTYPE_SUBMENU,
}; };
///
// Supported menu separator types.
///
enum cef_menu_separator_type_t {
MENUSEPARATORTYPE_NONE,
///
// Normal - top to bottom: Spacing, line, spacing
///
MENUSEPARATORTYPE_NORMAL,
///
// Upper - top to bottom: Line, spacing
///
MENUSEPARATORTYPE_UPPER,
///
// Lower - top to bottom: Spacing, line
///
MENUSEPARATORTYPE_LOWER,
///
// Spacing - top to bottom: Spacing only.
///
MENUSEPARATORTYPE_SPACING,
};
/// ///
// Supported context menu type flags. // Supported context menu type flags.
/// ///

View File

@ -206,13 +206,13 @@ void CefMenuCreator::CreateDefaultModel() {
model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO)); model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO));
model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO)); model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO));
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddSeparator();
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT)); model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT));
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY));
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE)); model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE));
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE)); model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE));
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddSeparator();
model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL)); model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL));
if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO)) if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO))
@ -237,7 +237,7 @@ void CefMenuCreator::CreateDefaultModel() {
model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK)); model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK));
model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD)); model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD));
model_->AddSeparator(MENUSEPARATORTYPE_NORMAL); model_->AddSeparator();
model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT)); model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT));
model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE)); model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE));

View File

@ -167,7 +167,6 @@ struct CefMenuModelImpl::Item {
const CefString& label, const CefString& label,
int group_id) int group_id)
: type_(type), : type_(type),
separator_type_(MENUSEPARATORTYPE_NONE),
command_id_(command_id), command_id_(command_id),
label_(label), label_(label),
group_id_(group_id), group_id_(group_id),
@ -183,7 +182,6 @@ struct CefMenuModelImpl::Item {
// Basic information. // Basic information.
cef_menu_item_type_t type_; cef_menu_item_type_t type_;
cef_menu_separator_type_t separator_type_;
int command_id_; int command_id_;
CefString label_; CefString label_;
int group_id_; int group_id_;
@ -227,17 +225,11 @@ int CefMenuModelImpl::GetCount() {
return static_cast<int>(items_.size()); return static_cast<int>(items_.size());
} }
bool CefMenuModelImpl::AddSeparator(MenuSeparatorType type) { bool CefMenuModelImpl::AddSeparator() {
if (!VerifyContext()) if (!VerifyContext())
return false; return false;
DCHECK(type != MENUSEPARATORTYPE_NONE); AppendItem(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1));
if (type == MENUSEPARATORTYPE_NONE)
return false;
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
item.separator_type_ = type;
AppendItem(item);
return true; return true;
} }
@ -277,17 +269,12 @@ CefRefPtr<CefMenuModel> CefMenuModelImpl::AddSubMenu(int command_id,
return item.submenu_.get(); return item.submenu_.get();
} }
bool CefMenuModelImpl::InsertSeparatorAt(int index, MenuSeparatorType type) { bool CefMenuModelImpl::InsertSeparatorAt(int index) {
if (!VerifyContext()) if (!VerifyContext())
return false; return false;
DCHECK(type != MENUSEPARATORTYPE_NONE); InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1),
if (type == MENUSEPARATORTYPE_NONE) index);
return false;
Item item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1);
item.separator_type_ = type;
InsertItemAt(item, index);
return true; return true;
} }
@ -417,16 +404,6 @@ CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) {
return MENUITEMTYPE_NONE; return MENUITEMTYPE_NONE;
} }
CefMenuModelImpl::MenuSeparatorType
CefMenuModelImpl::GetSeparatorTypeAt(int index) {
if (!VerifyContext())
return MENUSEPARATORTYPE_NONE;
if (index >= 0 && index < static_cast<int>(items_.size()))
return items_[index].separator_type_;
return MENUSEPARATORTYPE_NONE;
}
int CefMenuModelImpl::GetGroupId(int command_id) { int CefMenuModelImpl::GetGroupId(int command_id) {
return GetGroupIdAt(GetIndexOf(command_id)); return GetGroupIdAt(GetIndexOf(command_id));
} }

View File

@ -42,14 +42,14 @@ class CefMenuModelImpl : public CefMenuModel {
// CefMenuModel methods. // CefMenuModel methods.
virtual bool Clear() OVERRIDE; virtual bool Clear() OVERRIDE;
virtual int GetCount() OVERRIDE; virtual int GetCount() OVERRIDE;
virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE; virtual bool AddSeparator() OVERRIDE;
virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddRadioItem(int command_id, const CefString& label, virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE; int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id, virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE; const CefString& label) OVERRIDE;
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE; virtual bool InsertSeparatorAt(int index) OVERRIDE;
virtual bool InsertItemAt(int index, int command_id, virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE; const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id, virtual bool InsertCheckItemAt(int index, int command_id,
@ -69,7 +69,6 @@ class CefMenuModelImpl : public CefMenuModel {
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE; virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE; virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE; virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE; virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; virtual bool SetGroupId(int command_id, int group_id) OVERRIDE;

View File

@ -43,8 +43,7 @@ int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) {
return _retval; return _retval;
} }
int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self, int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) {
enum cef_menu_separator_type_t type) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -52,8 +51,7 @@ int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self,
return 0; return 0;
// Execute // Execute
bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator( bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator();
type);
// Return type: bool // Return type: bool
return _retval; return _retval;
@ -146,7 +144,7 @@ struct _cef_menu_model_t* CEF_CALLBACK menu_model_add_sub_menu(
} }
int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self, int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
int index, enum cef_menu_separator_type_t type) { int index) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
@ -155,8 +153,7 @@ int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self,
// Execute // Execute
bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt( bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt(
index, index);
type);
// Return type: bool // Return type: bool
return _retval; return _retval;
@ -440,23 +437,6 @@ enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at(
return _retval; return _retval;
} }
enum cef_menu_separator_type_t CEF_CALLBACK menu_model_get_separator_type_at(
struct _cef_menu_model_t* self, int index) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return MENUSEPARATORTYPE_NONE;
// Execute
cef_menu_separator_type_t _retval = CefMenuModelCppToC::Get(
self)->GetSeparatorTypeAt(
index);
// Return type: simple
return _retval;
}
int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self, int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self,
int command_id) { int command_id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -1005,7 +985,6 @@ CefMenuModelCppToC::CefMenuModelCppToC(CefMenuModel* cls)
struct_.struct_.set_label_at = menu_model_set_label_at; struct_.struct_.set_label_at = menu_model_set_label_at;
struct_.struct_.get_type = menu_model_get_type; struct_.struct_.get_type = menu_model_get_type;
struct_.struct_.get_type_at = menu_model_get_type_at; struct_.struct_.get_type_at = menu_model_get_type_at;
struct_.struct_.get_separator_type_at = menu_model_get_separator_type_at;
struct_.struct_.get_group_id = menu_model_get_group_id; struct_.struct_.get_group_id = menu_model_get_group_id;
struct_.struct_.get_group_id_at = menu_model_get_group_id_at; struct_.struct_.get_group_id_at = menu_model_get_group_id_at;
struct_.struct_.set_group_id = menu_model_set_group_id; struct_.struct_.set_group_id = menu_model_set_group_id;

View File

@ -41,15 +41,14 @@ int CefMenuModelCToCpp::GetCount() {
return _retval; return _retval;
} }
bool CefMenuModelCToCpp::AddSeparator(MenuSeparatorType type) { bool CefMenuModelCToCpp::AddSeparator() {
if (CEF_MEMBER_MISSING(struct_, add_separator)) if (CEF_MEMBER_MISSING(struct_, add_separator))
return false; return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute // Execute
int _retval = struct_->add_separator(struct_, int _retval = struct_->add_separator(struct_);
type);
// Return type: bool // Return type: bool
return _retval?true:false; return _retval?true:false;
@ -138,7 +137,7 @@ CefRefPtr<CefMenuModel> CefMenuModelCToCpp::AddSubMenu(int command_id,
return CefMenuModelCToCpp::Wrap(_retval); return CefMenuModelCToCpp::Wrap(_retval);
} }
bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) { bool CefMenuModelCToCpp::InsertSeparatorAt(int index) {
if (CEF_MEMBER_MISSING(struct_, insert_separator_at)) if (CEF_MEMBER_MISSING(struct_, insert_separator_at))
return false; return false;
@ -146,8 +145,7 @@ bool CefMenuModelCToCpp::InsertSeparatorAt(int index, MenuSeparatorType type) {
// Execute // Execute
int _retval = struct_->insert_separator_at(struct_, int _retval = struct_->insert_separator_at(struct_,
index, index);
type);
// Return type: bool // Return type: bool
return _retval?true:false; return _retval?true:false;
@ -413,21 +411,6 @@ CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) {
return _retval; return _retval;
} }
CefMenuModel::MenuSeparatorType CefMenuModelCToCpp::GetSeparatorTypeAt(
int index) {
if (CEF_MEMBER_MISSING(struct_, get_separator_type_at))
return MENUSEPARATORTYPE_NONE;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_menu_separator_type_t _retval = struct_->get_separator_type_at(struct_,
index);
// Return type: simple
return _retval;
}
int CefMenuModelCToCpp::GetGroupId(int command_id) { int CefMenuModelCToCpp::GetGroupId(int command_id) {
if (CEF_MEMBER_MISSING(struct_, get_group_id)) if (CEF_MEMBER_MISSING(struct_, get_group_id))
return 0; return 0;

View File

@ -34,14 +34,14 @@ class CefMenuModelCToCpp
// CefMenuModel methods // CefMenuModel methods
virtual bool Clear() OVERRIDE; virtual bool Clear() OVERRIDE;
virtual int GetCount() OVERRIDE; virtual int GetCount() OVERRIDE;
virtual bool AddSeparator(MenuSeparatorType type) OVERRIDE; virtual bool AddSeparator() OVERRIDE;
virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE;
virtual bool AddRadioItem(int command_id, const CefString& label, virtual bool AddRadioItem(int command_id, const CefString& label,
int group_id) OVERRIDE; int group_id) OVERRIDE;
virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id, virtual CefRefPtr<CefMenuModel> AddSubMenu(int command_id,
const CefString& label) OVERRIDE; const CefString& label) OVERRIDE;
virtual bool InsertSeparatorAt(int index, MenuSeparatorType type) OVERRIDE; virtual bool InsertSeparatorAt(int index) OVERRIDE;
virtual bool InsertItemAt(int index, int command_id, virtual bool InsertItemAt(int index, int command_id,
const CefString& label) OVERRIDE; const CefString& label) OVERRIDE;
virtual bool InsertCheckItemAt(int index, int command_id, virtual bool InsertCheckItemAt(int index, int command_id,
@ -61,7 +61,6 @@ class CefMenuModelCToCpp
virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE;
virtual MenuItemType GetType(int command_id) OVERRIDE; virtual MenuItemType GetType(int command_id) OVERRIDE;
virtual MenuItemType GetTypeAt(int index) OVERRIDE; virtual MenuItemType GetTypeAt(int index) OVERRIDE;
virtual MenuSeparatorType GetSeparatorTypeAt(int index) OVERRIDE;
virtual int GetGroupId(int command_id) OVERRIDE; virtual int GetGroupId(int command_id) OVERRIDE;
virtual int GetGroupIdAt(int index) OVERRIDE; virtual int GetGroupIdAt(int index) OVERRIDE;
virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; virtual bool SetGroupId(int command_id, int group_id) OVERRIDE;

View File

@ -94,7 +94,7 @@ void ClientHandler::OnBeforeContextMenu(
if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) { if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) {
// Add a separator if the menu already has items. // Add a separator if the menu already has items.
if (model->GetCount() > 0) if (model->GetCount() > 0)
model->AddSeparator(MENUSEPARATORTYPE_NORMAL); model->AddSeparator();
// Add a "Show DevTools" item to all context menus. // Add a "Show DevTools" item to all context menus.
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools"); model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
@ -490,7 +490,7 @@ void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) { void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
if (model->GetCount() > 0) if (model->GetCount() > 0)
model->AddSeparator(MENUSEPARATORTYPE_NORMAL); model->AddSeparator();
// Build the sub menu. // Build the sub menu.
CefRefPtr<CefMenuModel> submenu = CefRefPtr<CefMenuModel> submenu =