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

Side by Side Diff: apps/shell/browser/shell_app_window_api.cc

Issue 284393002: Remove unused shell_app_window_api.h/cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « apps/shell/browser/shell_app_window_api.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "apps/shell/browser/shell_app_window_api.h"
6
7 #include "apps/shell/browser/shell_app_window.h"
8 #include "apps/shell/browser/shell_desktop_controller.h"
9 #include "base/values.h"
10
11 using base::DictionaryValue;
12
13 namespace extensions {
14 namespace {
15
16 // Returns stub values for window bounds.
17 DictionaryValue* CreateStubBoundsProperties() {
18 DictionaryValue* properties = new DictionaryValue;
19 properties->SetInteger("left", 0);
20 properties->SetInteger("top", 0);
21 properties->SetInteger("width", 0);
22 properties->SetInteger("height", 0);
23 return properties;
24 }
25
26 // Creates a function call result to send to the renderer.
27 DictionaryValue* CreateResult(apps::ShellAppWindow* app_window) {
28 int view_id = app_window->GetRenderViewRoutingID();
29
30 DictionaryValue* result = new DictionaryValue;
31 result->Set("viewId", new base::FundamentalValue(view_id));
32 result->Set("injectTitlebar", new base::FundamentalValue(false));
33 result->Set("id", new base::StringValue("app_shell"));
34
35 // Add stub window property data.
36 result->SetBoolean("fullscreen", true);
37 result->SetBoolean("minimized", false);
38 result->SetBoolean("maximized", false);
39 result->SetBoolean("alwaysOnTop", false);
40 result->SetBoolean("hasFrameColor", false);
41 result->SetInteger("frameColor", 0);
42 result->Set("innerBounds", CreateStubBoundsProperties());
43 result->Set("outerBounds", CreateStubBoundsProperties());
44
45 return result;
46 }
47
48 } // namespace
49
50 ShellAppWindowCreateFunction::ShellAppWindowCreateFunction() {
51 }
52
53 ShellAppWindowCreateFunction::~ShellAppWindowCreateFunction() {
54 }
55
56 bool ShellAppWindowCreateFunction::RunAsync() {
57 // Arguments must contain a URL and may contain options and a callback.
58 if (args_->GetSize() < 1 || args_->GetSize() > 3)
59 return false;
60
61 // Extract the URL for the window contents, e.g. "main.html".
62 std::string url_string;
63 if (!args_->GetString(0, &url_string))
64 return false;
65
66 // Convert "main.html" to "chrome-extension:/<id>/main.html".
67 GURL url = GetExtension()->GetResourceURL(url_string);
68 if (!url.is_valid())
69 return false;
70
71 // The desktop keeps ownership of the window.
72 apps::ShellAppWindow* app_window =
73 apps::ShellDesktopController::instance()->CreateAppWindow(
74 browser_context());
75 app_window->LoadURL(url);
76
77 // Create the reply to send to the renderer.
78 DictionaryValue* result = CreateResult(app_window);
79 SetResult(result);
80
81 SendResponse(true /* success */);
82 return true;
83 }
84
85 } // namespace extensions
OLDNEW
« no previous file with comments | « apps/shell/browser/shell_app_window_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698