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

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: 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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DCHECK(rvh); 58 DCHECK(rvh);
59 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 59 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
60 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, 60 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute,
61 base::Unretained(ResourceDispatcherHost::Get()), 61 base::Unretained(ResourceDispatcherHost::Get()),
62 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); 62 rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 ShellWindow::CreateParams::CreateParams() 67 ShellWindow::CreateParams::CreateParams()
68 : frame(ShellWindow::CreateParams::FRAME_NONE), 68 : frame(ShellWindow::CreateParams::FRAME_CHROME),
69 bounds(-1, -1, kDefaultWidth, kDefaultHeight), 69 bounds(-1, -1, kDefaultWidth, kDefaultHeight),
70 restore_position(true), restore_size(true) { 70 restore_position(true), restore_size(true) {
71 } 71 }
72 72
73 ShellWindow::CreateParams::~CreateParams() { 73 ShellWindow::CreateParams::~CreateParams() {
74 } 74 }
75 75
76 ShellWindow* ShellWindow::Create(Profile* profile, 76 ShellWindow* ShellWindow::Create(Profile* profile,
77 const extensions::Extension* extension, 77 const extensions::Extension* extension,
78 const GURL& url, 78 const GURL& url,
(...skipping 21 matching lines...) Expand all
100 NULL); 100 NULL);
101 contents_.reset(TabContents::Factory::CreateTabContents(web_contents_)); 101 contents_.reset(TabContents::Factory::CreateTabContents(web_contents_));
102 content::WebContentsObserver::Observe(web_contents_); 102 content::WebContentsObserver::Observe(web_contents_);
103 web_contents_->SetDelegate(this); 103 web_contents_->SetDelegate(this);
104 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL); 104 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL);
105 web_contents_->GetMutableRendererPrefs()-> 105 web_contents_->GetMutableRendererPrefs()->
106 browser_handles_all_top_level_requests = true; 106 browser_handles_all_top_level_requests = true;
107 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 107 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
108 108
109 native_window_.reset(NativeShellWindow::Create(this, params)); 109 native_window_.reset(NativeShellWindow::Create(this, params));
110 // Interpretation of the bounds passed to NativeShellWindow::Create varies
111 // between the different implementations, SetBounds behaves more consistent
112 // so call that one here too. A fix for http://crbug.com/130184 should make
113 // this no longer needed.
114 if (params.bounds.x() >= 0 && params.bounds.y() >= 0) {
115 native_window_->SetBounds(params.bounds);
116 }
117 110
118 if (!params.window_key.empty()) { 111 if (!params.window_key.empty()) {
119 window_key_ = params.window_key; 112 window_key_ = params.window_key;
120 113
121 if (params.restore_position || params.restore_size) { 114 if (params.restore_position || params.restore_size) {
122 extensions::ShellWindowGeometryCache* cache = 115 extensions::ShellWindowGeometryCache* cache =
123 extensions::ExtensionSystem::Get(profile())-> 116 extensions::ExtensionSystem::Get(profile())->
124 shell_window_geometry_cache(); 117 shell_window_geometry_cache();
125 gfx::Rect cached_bounds; 118 gfx::Rect cached_bounds;
126 if (cache->GetGeometry(extension()->id(), params.window_key, 119 if (cache->GetGeometry(extension()->id(), params.window_key,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (window_key_.empty()) 447 if (window_key_.empty())
455 return; 448 return;
456 449
457 extensions::ShellWindowGeometryCache* cache = 450 extensions::ShellWindowGeometryCache* cache =
458 extensions::ExtensionSystem::Get(profile())-> 451 extensions::ExtensionSystem::Get(profile())->
459 shell_window_geometry_cache(); 452 shell_window_geometry_cache();
460 453
461 gfx::Rect bounds = native_window_->GetBounds(); 454 gfx::Rect bounds = native_window_->GetBounds();
462 cache->SaveGeometry(extension()->id(), window_key_, bounds); 455 cache->SaveGeometry(extension()->id(), window_key_, bounds);
463 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698