Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/browser/ui/toolbar/action_box_menu_model.cc

Issue 11073009: Include individual share intents in the action box and allow direct triggering without an intermedi… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tidying up for review Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" 5 #include "chrome/browser/ui/toolbar/action_box_menu_model.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/chrome_to_mobile_service.h" 10 #include "chrome/browser/chrome_to_mobile_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 rb.GetNativeImageNamed(IDR_MOBILE)); 45 rb.GetNativeImageNamed(IDR_MOBILE));
46 } 46 }
47 47
48 BookmarkTabHelper* bookmark_tab_helper = 48 BookmarkTabHelper* bookmark_tab_helper =
49 BookmarkTabHelper::FromWebContents(current_web_contents); 49 BookmarkTabHelper::FromWebContents(current_web_contents);
50 bool starred = bookmark_tab_helper->is_starred(); 50 bool starred = bookmark_tab_helper->is_starred();
51 AddItemWithStringId(IDC_BOOKMARK_PAGE, 51 AddItemWithStringId(IDC_BOOKMARK_PAGE,
52 starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR); 52 starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR);
53 SetIcon(GetIndexOfCommandId(IDC_BOOKMARK_PAGE), 53 SetIcon(GetIndexOfCommandId(IDC_BOOKMARK_PAGE),
54 rb.GetNativeImageNamed(starred ? IDR_STAR_LIT : IDR_STAR)); 54 rb.GetNativeImageNamed(starred ? IDR_STAR_LIT : IDR_STAR));
55
56 AddItemWithStringId(IDC_SHARE_PAGE, IDS_SHARE_PAGE);
57 SetIcon(GetIndexOfCommandId(IDC_SHARE_PAGE),
58 rb.GetNativeImageNamed(IDR_SHARE));
59 } 55 }
60 56
61 ActionBoxMenuModel::~ActionBoxMenuModel() { 57 ActionBoxMenuModel::~ActionBoxMenuModel() {
62 } 58 }
63 59
64 void ActionBoxMenuModel::AddExtension(const extensions::Extension& extension, 60 void ActionBoxMenuModel::AddExtension(const extensions::Extension& extension,
65 int command_id) { 61 int command_id) {
66 if (extension_ids_.empty()) 62 if (extension_ids_.empty())
67 AddSeparator(ui::NORMAL_SEPARATOR); 63 AddSeparator(ui::NORMAL_SEPARATOR);
68 extension_ids_.push_back(extension.id()); 64 extension_ids_.push_back(extension.id());
(...skipping 21 matching lines...) Expand all
90 extension_ids_[index_in_extension_ids]); 86 extension_ids_[index_in_extension_ids]);
91 } 87 }
92 88
93 void ActionBoxMenuModel::ExecuteCommand(int command_id) { 89 void ActionBoxMenuModel::ExecuteCommand(int command_id) {
94 delegate()->ExecuteCommand(command_id); 90 delegate()->ExecuteCommand(command_id);
95 } 91 }
96 92
97 int ActionBoxMenuModel::GetFirstExtensionIndex() { 93 int ActionBoxMenuModel::GetFirstExtensionIndex() {
98 return GetItemCount() - extension_ids_.size(); 94 return GetItemCount() - extension_ids_.size();
99 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698