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

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: addressing review nits 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
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_button_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Since web intents are not working in incognito window (issue 142463),
57 // hide "share this page" menu item in incognito mode
58 // till the issue gets fixed.
59 if (!browser_->profile()->IsOffTheRecord()) {
60 AddItemWithStringId(IDC_SHARE_PAGE, IDS_SHARE_PAGE);
61 SetIcon(GetIndexOfCommandId(IDC_SHARE_PAGE),
62 rb.GetNativeImageNamed(IDR_SHARE));
63 }
64 } 55 }
65 56
66 ActionBoxMenuModel::~ActionBoxMenuModel() { 57 ActionBoxMenuModel::~ActionBoxMenuModel() {
67 } 58 }
68 59
69 void ActionBoxMenuModel::AddExtension(const extensions::Extension& extension, 60 void ActionBoxMenuModel::AddExtension(const extensions::Extension& extension,
70 int command_id) { 61 int command_id) {
71 if (extension_ids_.empty()) 62 if (extension_ids_.empty())
72 AddSeparator(ui::NORMAL_SEPARATOR); 63 AddSeparator(ui::NORMAL_SEPARATOR);
73 extension_ids_.push_back(extension.id()); 64 extension_ids_.push_back(extension.id());
(...skipping 21 matching lines...) Expand all
95 extension_ids_[index_in_extension_ids]); 86 extension_ids_[index_in_extension_ids]);
96 } 87 }
97 88
98 void ActionBoxMenuModel::ExecuteCommand(int command_id) { 89 void ActionBoxMenuModel::ExecuteCommand(int command_id) {
99 delegate()->ExecuteCommand(command_id); 90 delegate()->ExecuteCommand(command_id);
100 } 91 }
101 92
102 int ActionBoxMenuModel::GetFirstExtensionIndex() { 93 int ActionBoxMenuModel::GetFirstExtensionIndex() {
103 return GetItemCount() - extension_ids_.size(); 94 return GetItemCount() - extension_ids_.size();
104 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/action_box_button_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698