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

Side by Side Diff: chrome/browser/ui/views/extensions/shell_window_views.cc

Issue 10967036: views: Packaged app window icon should be system/generic icon, if icon is not set by default. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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
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/views/extensions/shell_window_views.h" 5 #include "chrome/browser/ui/views/extensions/shell_window_views.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/favicon/favicon_tab_helper.h" 9 #include "chrome/browser/favicon/favicon_tab_helper.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 10 matching lines...) Expand all
21 #include "ui/base/hit_test.h" 21 #include "ui/base/hit_test.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
26 #include "ui/gfx/path.h" 26 #include "ui/gfx/path.h"
27 #include "ui/views/controls/button/button.h" 27 #include "ui/views/controls/button/button.h"
28 #include "ui/views/controls/button/image_button.h" 28 #include "ui/views/controls/button/image_button.h"
29 #include "ui/views/controls/webview/webview.h" 29 #include "ui/views/controls/webview/webview.h"
30 #include "ui/views/layout/grid_layout.h" 30 #include "ui/views/layout/grid_layout.h"
31 #include "ui/views/views_delegate.h"
31 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
32 #include "ui/views/window/non_client_view.h" 33 #include "ui/views/window/non_client_view.h"
33 34
34 #if defined(OS_WIN) && !defined(USE_AURA) 35 #if defined(OS_WIN) && !defined(USE_AURA)
35 #include "chrome/browser/shell_integration.h" 36 #include "chrome/browser/shell_integration.h"
36 #include "chrome/browser/web_applications/web_app.h" 37 #include "chrome/browser/web_applications/web_app.h"
37 #include "ui/base/win/shell.h" 38 #include "ui/base/win/shell.h"
38 #endif 39 #endif
39 40
40 #if defined(USE_ASH) 41 #if defined(USE_ASH)
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 : shell_window_(shell_window), 319 : shell_window_(shell_window),
319 web_view_(NULL), 320 web_view_(NULL),
320 is_fullscreen_(false), 321 is_fullscreen_(false),
321 frameless_(win_params.frame == ShellWindow::CreateParams::FRAME_NONE) { 322 frameless_(win_params.frame == ShellWindow::CreateParams::FRAME_NONE) {
322 window_ = new views::Widget; 323 window_ = new views::Widget;
323 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 324 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
324 params.delegate = this; 325 params.delegate = this;
325 params.remove_standard_frame = true; 326 params.remove_standard_frame = true;
326 minimum_size_ = win_params.minimum_size; 327 minimum_size_ = win_params.minimum_size;
327 maximum_size_ = win_params.maximum_size; 328 maximum_size_ = win_params.maximum_size;
329
330 // Set the views::ViewsDelegate::views_delegate to NULL
331 // when initialize widget for shell window,
332 // which would remove chrome specific setting for widget,
333 // such as default icon.
334 views::ViewsDelegate* original_delegate =
sky 2012/09/21 16:15:51 This feels like a hack and is likely to be problem
335 views::ViewsDelegate::views_delegate;
336 views::ViewsDelegate::views_delegate = NULL;
328 window_->Init(params); 337 window_->Init(params);
338 views::ViewsDelegate::views_delegate = original_delegate;
339
329 gfx::Rect window_bounds = 340 gfx::Rect window_bounds =
330 window_->non_client_view()->GetWindowBoundsForClientBounds( 341 window_->non_client_view()->GetWindowBoundsForClientBounds(
331 win_params.bounds); 342 win_params.bounds);
332 window_->SetBounds(window_bounds); 343 window_->SetBounds(window_bounds);
333 // Center window if no position was specified. 344 // Center window if no position was specified.
334 if (win_params.bounds.x() < 0 || win_params.bounds.y() < 0) 345 if (win_params.bounds.x() < 0 || win_params.bounds.y() < 0)
335 window_->CenterWindow(window_bounds.size()); 346 window_->CenterWindow(window_bounds.size());
336 #if defined(OS_WIN) && !defined(USE_AURA) 347 #if defined(OS_WIN) && !defined(USE_AURA)
337 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( 348 std::string app_name = web_app::GenerateApplicationNameFromExtensionId(
338 extension()->id()); 349 extension()->id());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 ui::WindowShowState show_state) { 662 ui::WindowShowState show_state) {
652 views::WidgetDelegate::SaveWindowPlacement(bounds, show_state); 663 views::WidgetDelegate::SaveWindowPlacement(bounds, show_state);
653 shell_window_->SaveWindowPosition(); 664 shell_window_->SaveWindowPosition();
654 } 665 }
655 666
656 // static 667 // static
657 NativeShellWindow* NativeShellWindow::Create( 668 NativeShellWindow* NativeShellWindow::Create(
658 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { 669 ShellWindow* shell_window, const ShellWindow::CreateParams& params) {
659 return new ShellWindowViews(shell_window, params); 670 return new ShellWindowViews(shell_window, params);
660 } 671 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698