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

Side by Side Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 11028125: Remove legacy draggable region code and refactor to share common draggable region code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 8 years, 2 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 307 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
308 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions, 308 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions,
309 UpdateDraggableRegions) 309 UpdateDraggableRegions)
310 IPC_MESSAGE_UNHANDLED(handled = false) 310 IPC_MESSAGE_UNHANDLED(handled = false)
311 IPC_END_MESSAGE_MAP() 311 IPC_END_MESSAGE_MAP()
312 return handled; 312 return handled;
313 } 313 }
314 314
315 void ShellWindow::UpdateDraggableRegions( 315 void ShellWindow::UpdateDraggableRegions(
316 const std::vector<extensions::DraggableRegion>& regions) { 316 const std::vector<extensions::DraggableRegion>& regions) {
317 // Decide if we want to treat it as old syntax by checking labels. 317 native_window_->UpdateDraggableRegions(regions);
318 // TODO(jianli): to be removed after WebKit patch that changes the draggable
319 // region syntax is landed.
320 bool new_syntax = true;
321 for (std::vector<extensions::DraggableRegion>::const_iterator iter =
322 regions.begin();
323 iter != regions.end(); ++iter) {
324 const extensions::DraggableRegion& region = *iter;
325 if (!region.label.empty() || !region.clip.IsEmpty()) {
326 new_syntax = false;
327 break;
328 }
329 }
330
331 if (new_syntax)
332 native_window_->UpdateDraggableRegions(regions);
333 else
334 native_window_->UpdateLegacyDraggableRegions(regions);
335 } 318 }
336 319
337 void ShellWindow::OnImageLoaded(const gfx::Image& image, 320 void ShellWindow::OnImageLoaded(const gfx::Image& image,
338 const std::string& extension_id, 321 const std::string& extension_id,
339 int index) { 322 int index) {
340 if (!image.IsEmpty()) { 323 if (!image.IsEmpty()) {
341 app_icon_ = image; 324 app_icon_ = image;
342 native_window_->UpdateWindowIcon(); 325 native_window_->UpdateWindowIcon();
343 } 326 }
344 app_icon_loader_.reset(); 327 app_icon_loader_.reset();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 if (window_key_.empty()) 455 if (window_key_.empty())
473 return; 456 return;
474 457
475 extensions::ShellWindowGeometryCache* cache = 458 extensions::ShellWindowGeometryCache* cache =
476 extensions::ExtensionSystem::Get(profile())-> 459 extensions::ExtensionSystem::Get(profile())->
477 shell_window_geometry_cache(); 460 shell_window_geometry_cache();
478 461
479 gfx::Rect bounds = native_window_->GetBounds(); 462 gfx::Rect bounds = native_window_->GetBounds();
480 cache->SaveGeometry(extension()->id(), window_key_, bounds); 463 cache->SaveGeometry(extension()->id(), window_key_, bounds);
481 } 464 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698