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

Side by Side Diff: chrome/browser/tab_contents/menu_category_factory.cc

Issue 169093009: Separate out logic to handle different category/group of context menu items from RVContextMenu class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work-mmm-refactor1
Patch Set: fix incorrect dcheck + platform app logic Created 6 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/tab_contents/menu_category_factory.h"
6
7 #include "chrome/browser/app_mode/app_mode_utils.h"
8 #include "chrome/browser/tab_contents/menu_category_app_mode.h"
9 #include "chrome/browser/tab_contents/menu_category_base.h"
10 #include "chrome/browser/tab_contents/menu_category_extension_popup.h"
11 #include "chrome/browser/tab_contents/menu_category_guest.h"
12 #include "chrome/browser/tab_contents/menu_category_panel.h"
13 #include "chrome/browser/tab_contents/menu_category_platform_app.h"
14 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/render_process_host.h"
16 #include "content/public/browser/web_contents.h"
17 #include "extensions/browser/view_type_utils.h"
18 #include "extensions/common/extension.h"
19
20 MenuCategoryFactory::MenuCategoryFactory() {
21 }
22
23 MenuCategoryFactory::~MenuCategoryFactory() {
24 }
25
26 // static.
27 MenuCategoryBase* MenuCategoryFactory::Create(
28 content::WebContents* web_contents,
29 content::RenderFrameHost* render_frame_host,
30 const content::ContextMenuParams& params) {
31 if (render_frame_host && render_frame_host->GetProcess()->IsGuest())
32 return new MenuCategoryGuest(render_frame_host, params);
Fady Samuel 2014/02/24 19:07:29 I would love for this to be moved to chrome/browse
lazyboy 2014/02/24 23:45:00 Done.
33
34 if (chrome::IsRunningInForcedAppMode())
35 return new MenuCategoryAppMode(render_frame_host, params);
36
37 const extensions::ViewType view_type = extensions::GetViewType(web_contents);
38
39 if (view_type == extensions::VIEW_TYPE_APP_WINDOW)
40 return new MenuCategoryPlatformApp(render_frame_host, params);
41
42 if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP)
43 return new MenuCategoryExtensionPopup(render_frame_host, params);
44
45 if (view_type == extensions::VIEW_TYPE_PANEL)
46 return new MenuCategoryPanel(render_frame_host, params);
47
48 return new MenuCategoryBase(render_frame_host, params);
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698