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

Side by Side Diff: chrome/browser/ui/extensions/shell_window.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: Only allow {frame:'experimental-html'} when --enable-experimental-extension-apis 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/extensions/shell_window.h" 5 #include "chrome/browser/ui/extensions/shell_window.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/shell_window_geometry_cache.h" 10 #include "chrome/browser/extensions/shell_window_geometry_cache.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DCHECK(rvh); 57 DCHECK(rvh);
58 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 58 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
59 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, 59 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute,
60 base::Unretained(ResourceDispatcherHost::Get()), 60 base::Unretained(ResourceDispatcherHost::Get()),
61 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); 61 rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
62 } 62 }
63 63
64 } // namespace 64 } // namespace
65 65
66 ShellWindow::CreateParams::CreateParams() 66 ShellWindow::CreateParams::CreateParams()
67 : frame(ShellWindow::CreateParams::FRAME_NONE), 67 : frame(ShellWindow::CreateParams::FRAME_CHROME),
68 bounds(-1, -1, kDefaultWidth, kDefaultHeight), 68 bounds(-1, -1, kDefaultWidth, kDefaultHeight),
69 restore_position(true), restore_size(true) { 69 restore_position(true), restore_size(true) {
70 } 70 }
71 71
72 ShellWindow::CreateParams::~CreateParams() { 72 ShellWindow::CreateParams::~CreateParams() {
73 } 73 }
74 74
75 ShellWindow* ShellWindow::Create(Profile* profile, 75 ShellWindow* ShellWindow::Create(Profile* profile,
76 const extensions::Extension* extension, 76 const extensions::Extension* extension,
77 const GURL& url, 77 const GURL& url,
(...skipping 21 matching lines...) Expand all
99 NULL); 99 NULL);
100 contents_.reset(TabContents::Factory::CreateTabContents(web_contents_)); 100 contents_.reset(TabContents::Factory::CreateTabContents(web_contents_));
101 content::WebContentsObserver::Observe(web_contents_); 101 content::WebContentsObserver::Observe(web_contents_);
102 web_contents_->SetDelegate(this); 102 web_contents_->SetDelegate(this);
103 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL); 103 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL);
104 web_contents_->GetMutableRendererPrefs()-> 104 web_contents_->GetMutableRendererPrefs()->
105 browser_handles_all_top_level_requests = true; 105 browser_handles_all_top_level_requests = true;
106 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 106 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
107 107
108 native_window_.reset(NativeShellWindow::Create(this, params)); 108 native_window_.reset(NativeShellWindow::Create(this, params));
109 // Interpretation of the bounds passed to NativeShellWindow::Create varies
110 // between the different implementations, SetBounds behaves more consistent
111 // so call that one here too. A fix for http://crbug.com/130184 should make
112 // this no longer needed.
113 if (params.bounds.x() >= 0 && params.bounds.y() >= 0) {
114 native_window_->SetBounds(params.bounds);
115 }
116 109
117 if (!params.window_key.empty()) { 110 if (!params.window_key.empty()) {
118 window_key_ = params.window_key; 111 window_key_ = params.window_key;
119 112
120 if (params.restore_position || params.restore_size) { 113 if (params.restore_position || params.restore_size) {
121 extensions::ShellWindowGeometryCache* cache = 114 extensions::ShellWindowGeometryCache* cache =
122 extensions::ExtensionSystem::Get(profile())-> 115 extensions::ExtensionSystem::Get(profile())->
123 shell_window_geometry_cache(); 116 shell_window_geometry_cache();
124 gfx::Rect cached_bounds; 117 gfx::Rect cached_bounds;
125 if (cache->GetGeometry(extension()->id(), params.window_key, 118 if (cache->GetGeometry(extension()->id(), params.window_key,
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 return; 440 return;
448 441
449 extensions::ShellWindowGeometryCache* cache = 442 extensions::ShellWindowGeometryCache* cache =
450 extensions::ExtensionSystem::Get(profile())-> 443 extensions::ExtensionSystem::Get(profile())->
451 shell_window_geometry_cache(); 444 shell_window_geometry_cache();
452 445
453 gfx::Rect bounds = native_window_->GetBounds(); 446 gfx::Rect bounds = native_window_->GetBounds();
454 cache->SaveGeometry(extension()->id(), window_key_, bounds); 447 cache->SaveGeometry(extension()->id(), window_key_, bounds);
455 } 448 }
456 449
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698