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

Side by Side Diff: athena/content/render_view_context_menu_impl.cc

Issue 591803002: Add athena_strings.grd with athena specific strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « athena/content/DEPS ('k') | athena/content/web_activity.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/content/render_view_context_menu_impl.h" 5 #include "athena/content/render_view_context_menu_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "athena/strings/grit/athena_strings.h"
8 #include "components/renderer_context_menu/context_menu_content_type.h" 8 #include "components/renderer_context_menu/context_menu_content_type.h"
9 #include "components/renderer_context_menu/views/toolkit_delegate_views.h" 9 #include "components/renderer_context_menu/views/toolkit_delegate_views.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "third_party/WebKit/public/web/WebContextMenuData.h" 12 #include "third_party/WebKit/public/web/WebContextMenuData.h"
13 #include "ui/base/l10n/l10n_util.h"
13 14
14 namespace athena { 15 namespace athena {
15 using blink::WebContextMenuData; 16 using blink::WebContextMenuData;
16 17
17 namespace { 18 namespace {
18 19
19 enum { 20 enum {
20 // Nativation 21 // Nativation
21 CMD_BACK = 0, 22 CMD_BACK = 0,
22 CMD_FORWARD, 23 CMD_FORWARD,
(...skipping 14 matching lines...) Expand all
37 CMD_SELECT_ALL, 38 CMD_SELECT_ALL,
38 CMD_LAST, 39 CMD_LAST,
39 }; 40 };
40 41
41 // Max number of custom command ids allowd. 42 // Max number of custom command ids allowd.
42 const int kNumCustomCommandIds = 1000; 43 const int kNumCustomCommandIds = 1000;
43 44
44 // TODO(oshima): Move IDS for context menus to components/renderer_context_menu 45 // TODO(oshima): Move IDS for context menus to components/renderer_context_menu
45 // and replace hardcoded strings below. 46 // and replace hardcoded strings below.
46 void AppendPageItems(ui::SimpleMenuModel* menu_model) { 47 void AppendPageItems(ui::SimpleMenuModel* menu_model) {
47 menu_model->AddItem(CMD_BACK, base::ASCIIToUTF16("Back")); 48 menu_model->AddItem(CMD_BACK,
48 menu_model->AddItem(CMD_FORWARD, base::ASCIIToUTF16("Forward")); 49 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_BACK));
49 menu_model->AddItem(CMD_RELOAD, base::ASCIIToUTF16("Reload")); 50 menu_model->AddItem(CMD_FORWARD,
51 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_FORWARD));
52 menu_model->AddItem(CMD_RELOAD,
53 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_RELOAD));
50 menu_model->AddSeparator(ui::NORMAL_SEPARATOR); 54 menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
51 menu_model->AddItem(CMD_VIEW_SOURCE, base::ASCIIToUTF16("View Source")); 55 menu_model->AddItem(
56 CMD_VIEW_SOURCE,
57 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_VIEWPAGESOURCE));
52 } 58 }
53 59
54 void AppendLinkItems(const content::ContextMenuParams& params, 60 void AppendLinkItems(const content::ContextMenuParams& params,
55 ui::SimpleMenuModel* menu_model) { 61 ui::SimpleMenuModel* menu_model) {
56 if (!params.link_url.is_empty()) 62 if (!params.link_url.is_empty())
57 menu_model->AddItem(CMD_OPEN_LINK_NEW_ACTIVITY, 63 menu_model->AddItem(
58 base::ASCIIToUTF16("Open Link In New Activity")); 64 CMD_OPEN_LINK_NEW_ACTIVITY,
65 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_OPENLINKNEWACTIVITY));
59 } 66 }
60 67
61 void AppendEditableItems(ui::SimpleMenuModel* menu_model) { 68 void AppendEditableItems(ui::SimpleMenuModel* menu_model) {
62 menu_model->AddItem(CMD_UNDO, base::ASCIIToUTF16("Undo")); 69 menu_model->AddItem(CMD_UNDO,
63 menu_model->AddItem(CMD_REDO, base::ASCIIToUTF16("Redo")); 70 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_UNDO));
71 menu_model->AddItem(CMD_REDO,
72 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_REDO));
64 menu_model->AddSeparator(ui::NORMAL_SEPARATOR); 73 menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
65 menu_model->AddItem(CMD_CUT, base::ASCIIToUTF16("Cut")); 74 menu_model->AddItem(CMD_CUT,
66 menu_model->AddItem(CMD_COPY, base::ASCIIToUTF16("Copy")); 75 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_CUT));
67 menu_model->AddItem(CMD_PASTE, base::ASCIIToUTF16("Paste")); 76 menu_model->AddItem(CMD_COPY,
68 menu_model->AddItem(CMD_PASTE_AND_MATCH_STYLE, 77 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_COPY));
69 base::ASCIIToUTF16("Paste as plain text")); 78 menu_model->AddItem(CMD_PASTE,
70 menu_model->AddItem(CMD_DELETE, base::ASCIIToUTF16("Delete")); 79 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_PASTE));
80 menu_model->AddItem(
81 CMD_PASTE_AND_MATCH_STYLE,
82 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_PASTE_AND_MATCH_STYLE));
83 menu_model->AddItem(CMD_DELETE,
84 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_DELETE));
71 menu_model->AddSeparator(ui::NORMAL_SEPARATOR); 85 menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
72 menu_model->AddItem(CMD_SELECT_ALL, base::ASCIIToUTF16("Select All")); 86 menu_model->AddItem(CMD_SELECT_ALL,
87 l10n_util::GetStringUTF16(IDS_ATHENA_CONTEXT_SELECTALL));
73 } 88 }
74 89
75 } // namespace 90 } // namespace
76 91
77 RenderViewContextMenuImpl::RenderViewContextMenuImpl( 92 RenderViewContextMenuImpl::RenderViewContextMenuImpl(
78 content::RenderFrameHost* render_frame_host, 93 content::RenderFrameHost* render_frame_host,
79 const content::ContextMenuParams& params) 94 const content::ContextMenuParams& params)
80 : RenderViewContextMenuBase(render_frame_host, params) { 95 : RenderViewContextMenuBase(render_frame_host, params) {
81 SetContentCustomCommandIdRange(CMD_LAST, CMD_LAST + kNumCustomCommandIds); 96 SetContentCustomCommandIdRange(CMD_LAST, CMD_LAST + kNumCustomCommandIds);
82 // TODO(oshima): Support other types 97 // TODO(oshima): Support other types
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 source_web_contents_->Delete(); 273 source_web_contents_->Delete();
259 break; 274 break;
260 275
261 case CMD_SELECT_ALL: 276 case CMD_SELECT_ALL:
262 source_web_contents_->SelectAll(); 277 source_web_contents_->SelectAll();
263 break; 278 break;
264 } 279 }
265 } 280 }
266 281
267 } // namespace athena 282 } // namespace athena
OLDNEW
« no previous file with comments | « athena/content/DEPS ('k') | athena/content/web_activity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698