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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/menu_category_factory.cc
diff --git a/chrome/browser/tab_contents/menu_category_factory.cc b/chrome/browser/tab_contents/menu_category_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d5a3042240d6f112a3e12d3189be376b272a7b13
--- /dev/null
+++ b/chrome/browser/tab_contents/menu_category_factory.cc
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/tab_contents/menu_category_factory.h"
+
+#include "chrome/browser/app_mode/app_mode_utils.h"
+#include "chrome/browser/tab_contents/menu_category_app_mode.h"
+#include "chrome/browser/tab_contents/menu_category_base.h"
+#include "chrome/browser/tab_contents/menu_category_extension_popup.h"
+#include "chrome/browser/tab_contents/menu_category_guest.h"
+#include "chrome/browser/tab_contents/menu_category_panel.h"
+#include "chrome/browser/tab_contents/menu_category_platform_app.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
+#include "extensions/browser/view_type_utils.h"
+#include "extensions/common/extension.h"
+
+MenuCategoryFactory::MenuCategoryFactory() {
+}
+
+MenuCategoryFactory::~MenuCategoryFactory() {
+}
+
+// static.
+MenuCategoryBase* MenuCategoryFactory::Create(
+ content::WebContents* web_contents,
+ content::RenderFrameHost* render_frame_host,
+ const content::ContextMenuParams& params) {
+ if (render_frame_host && render_frame_host->GetProcess()->IsGuest())
+ 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.
+
+ if (chrome::IsRunningInForcedAppMode())
+ return new MenuCategoryAppMode(render_frame_host, params);
+
+ const extensions::ViewType view_type = extensions::GetViewType(web_contents);
+
+ if (view_type == extensions::VIEW_TYPE_APP_WINDOW)
+ return new MenuCategoryPlatformApp(render_frame_host, params);
+
+ if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP)
+ return new MenuCategoryExtensionPopup(render_frame_host, params);
+
+ if (view_type == extensions::VIEW_TYPE_PANEL)
+ return new MenuCategoryPanel(render_frame_host, params);
+
+ return new MenuCategoryBase(render_frame_host, params);
+}

Powered by Google App Engine
This is Rietveld 408576698