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

Unified Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 10917274: Re-enable native UI for {frame:'chrome'} in app windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/app_window/app_window_api.cc
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index 6d5205c5550a770578bfc673f36836e19f81ef36..bf85d462a5a71cee268c9819862499a1e5157089 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/extensions/api/app_window/app_window_api.h"
+#include "base/command_line.h"
#include "base/time.h"
#include "base/values.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/ui/extensions/shell_window.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/app_window.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -26,6 +28,7 @@ const char kInvalidWindowId[] =
};
const char kNoneFrameOption[] = "none";
+const char kHtmlFrameOption[] = "experimental-html";
bool AppWindowCreateFunction::RunImpl() {
scoped_ptr<Create::Params> params(Create::Params::Create(*args_));
@@ -33,6 +36,8 @@ bool AppWindowCreateFunction::RunImpl() {
GURL url = GetExtension()->GetResourceURL(params->url);
+ bool inject_html_titlebar = false;
+
// TODO(jeremya): figure out a way to pass the opening WebContents through to
// ShellWindow::Create so we can set the opener at create time rather than
// with a hack in AppWindowCustomBindings::GetView().
@@ -76,6 +81,19 @@ bool AppWindowCreateFunction::RunImpl() {
create_params.restore_position = false;
}
+ if (options->frame.get()) {
+ if (*options->frame == kHtmlFrameOption &&
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalExtensionApis)) {
+ create_params.frame = ShellWindow::CreateParams::FRAME_NONE;
+ inject_html_titlebar = true;
+ } else if (*options->frame == kNoneFrameOption) {
+ create_params.frame = ShellWindow::CreateParams::FRAME_NONE;
+ } else {
+ create_params.frame = ShellWindow::CreateParams::FRAME_CHROME;
+ }
+ }
+
gfx::Size& minimum_size = create_params.minimum_size;
if (options->min_width.get())
minimum_size.set_width(*options->min_width);
@@ -112,7 +130,11 @@ bool AppWindowCreateFunction::RunImpl() {
content::WebContents* created_contents = shell_window->web_contents();
int view_id = created_contents->GetRenderViewHost()->GetRoutingID();
- SetResult(base::Value::CreateIntegerValue(view_id));
+ base::DictionaryValue* result = new base::DictionaryValue;
+ result->Set("viewId", base::Value::CreateIntegerValue(view_id));
+ result->Set("injectTitlebar",
+ base::Value::CreateBooleanValue(inject_html_titlebar));
+ SetResult(result);
return true;
}
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698