// Copyright (c) 2011 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/ui/views/frame/browser_non_client_frame_view.h"

#include "base/command_line.h"
#include "chrome/browser/ui/panels/panel_browser_frame_view.h"
#include "chrome/browser/ui/panels/panel_browser_view.h"
#include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/popup_non_client_frame_view.h"
#include "chrome/common/chrome_switches.h"

namespace browser {

BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
    BrowserFrame* frame, BrowserView* browser_view) {
  Browser::Type type = browser_view->browser()->type();
  switch (type) {
    case Browser::TYPE_PANEL:
      if (CommandLine::ForCurrentProcess()->HasSwitch(
              switches::kEnablePanels)) {
        return new PanelBrowserFrameView(
            frame, static_cast<PanelBrowserView*>(browser_view));
      }  // else, fall-through and treat as popup
    case Browser::TYPE_POPUP:
      // TODO(anicolao): implement popups for touch
      NOTIMPLEMENTED();
      return new PopupNonClientFrameView(frame);
    default:
      return new TouchBrowserFrameView(frame, browser_view);
  }
}

}  // browser

// Copyright (c) 2011 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/ui/views/frame/browser_non_client_frame_view.h"

#include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/popup_non_client_frame_view.h"

namespace browser {

BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
    BrowserFrame* frame, BrowserView* browser_view) {
  if (browser_view->IsBrowserTypePopup() ||
      browser_view->IsBrowserTypePanel()) {
    // TODO(anicolao): implement popups for touch
    NOTIMPLEMENTED();
    return new PopupNonClientFrameView(frame);
  } else {
    return new TouchBrowserFrameView(frame, browser_view);
  }
}

}  // browser

--- 
+++ 
@@ -4,21 +4,32 @@
 
 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
 
+#include "base/command_line.h"
+#include "chrome/browser/ui/panels/panel_browser_frame_view.h"
+#include "chrome/browser/ui/panels/panel_browser_view.h"
 #include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
 #include "chrome/browser/ui/views/frame/browser_view.h"
 #include "chrome/browser/ui/views/frame/popup_non_client_frame_view.h"
+#include "chrome/common/chrome_switches.h"
 
 namespace browser {
 
 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
     BrowserFrame* frame, BrowserView* browser_view) {
-  if (browser_view->IsBrowserTypePopup() ||
-      browser_view->IsBrowserTypePanel()) {
-    // TODO(anicolao): implement popups for touch
-    NOTIMPLEMENTED();
-    return new PopupNonClientFrameView(frame);
-  } else {
-    return new TouchBrowserFrameView(frame, browser_view);
+  Browser::Type type = browser_view->browser()->type();
+  switch (type) {
+    case Browser::TYPE_PANEL:
+      if (CommandLine::ForCurrentProcess()->HasSwitch(
+              switches::kEnablePanels)) {
+        return new PanelBrowserFrameView(
+            frame, static_cast<PanelBrowserView*>(browser_view));
+      }  // else, fall-through and treat as popup
+    case Browser::TYPE_POPUP:
+      // TODO(anicolao): implement popups for touch
+      NOTIMPLEMENTED();
+      return new PopupNonClientFrameView(frame);
+    default:
+      return new TouchBrowserFrameView(frame, browser_view);
   }
 }
 
Use the normal panel-frame until there's a touch-friendly version.

BUG=none
TEST=browser_test:WindowOpenPanel

Review URL: http://codereview.chromium.org/7192001

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@89364 0039d316-1c4b-4281-b951-d872f2087c98
