| OLD | NEW |
| 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/views/extensions/extension_keybinding_registry_views
.h" | 10 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 is_fullscreen_(false), | 402 is_fullscreen_(false), |
| 403 frameless_(win_params.frame == ShellWindow::CreateParams::FRAME_NONE) { | 403 frameless_(win_params.frame == ShellWindow::CreateParams::FRAME_NONE) { |
| 404 window_ = new views::Widget; | 404 window_ = new views::Widget; |
| 405 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 405 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 406 params.delegate = this; | 406 params.delegate = this; |
| 407 params.remove_standard_frame = true; | 407 params.remove_standard_frame = true; |
| 408 params.use_system_default_icon = true; | 408 params.use_system_default_icon = true; |
| 409 minimum_size_ = win_params.minimum_size; | 409 minimum_size_ = win_params.minimum_size; |
| 410 maximum_size_ = win_params.maximum_size; | 410 maximum_size_ = win_params.maximum_size; |
| 411 window_->Init(params); | 411 window_->Init(params); |
| 412 gfx::Rect window_bounds = | 412 gfx::Rect window_bounds = win_params.bounds; |
| 413 window_->non_client_view()->GetWindowBoundsForClientBounds( | 413 window_bounds.Inset(-GetFrameInsets()); |
| 414 win_params.bounds); | |
| 415 // Center window if no position was specified. | 414 // Center window if no position was specified. |
| 416 if (win_params.bounds.x() == INT_MIN || win_params.bounds.y() == INT_MIN) { | 415 if (win_params.bounds.x() == INT_MIN || win_params.bounds.y() == INT_MIN) { |
| 417 window_->CenterWindow(window_bounds.size()); | 416 window_->CenterWindow(window_bounds.size()); |
| 418 } else { | 417 } else { |
| 419 window_->SetBounds(window_bounds); | 418 window_->SetBounds(window_bounds); |
| 420 } | 419 } |
| 421 #if defined(OS_WIN) && !defined(USE_AURA) | 420 #if defined(OS_WIN) && !defined(USE_AURA) |
| 422 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( | 421 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( |
| 423 extension()->id()); | 422 extension()->id()); |
| 424 ui::win::SetAppIdForWindow( | 423 ui::win::SetAppIdForWindow( |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 } | 566 } |
| 568 | 567 |
| 569 void ShellWindowViews::FlashFrame(bool flash) { | 568 void ShellWindowViews::FlashFrame(bool flash) { |
| 570 window_->FlashFrame(flash); | 569 window_->FlashFrame(flash); |
| 571 } | 570 } |
| 572 | 571 |
| 573 bool ShellWindowViews::IsAlwaysOnTop() const { | 572 bool ShellWindowViews::IsAlwaysOnTop() const { |
| 574 return false; | 573 return false; |
| 575 } | 574 } |
| 576 | 575 |
| 576 gfx::Insets ShellWindowViews::GetFrameInsets() const { |
| 577 if (frameless()) |
| 578 return gfx::Insets(); |
| 579 |
| 580 return gfx::Insets(kCaptionHeight, 0, 0, 0); |
| 581 } |
| 582 |
| 577 void ShellWindowViews::DeleteDelegate() { | 583 void ShellWindowViews::DeleteDelegate() { |
| 578 shell_window_->OnNativeClose(); | 584 shell_window_->OnNativeClose(); |
| 579 } | 585 } |
| 580 | 586 |
| 581 bool ShellWindowViews::CanResize() const { | 587 bool ShellWindowViews::CanResize() const { |
| 582 return maximum_size_.IsEmpty() || minimum_size_ != maximum_size_; | 588 return maximum_size_.IsEmpty() || minimum_size_ != maximum_size_; |
| 583 } | 589 } |
| 584 | 590 |
| 585 bool ShellWindowViews::CanMaximize() const { | 591 bool ShellWindowViews::CanMaximize() const { |
| 586 return CanResize(); | 592 return CanResize(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 ui::WindowShowState show_state) { | 740 ui::WindowShowState show_state) { |
| 735 views::WidgetDelegate::SaveWindowPlacement(bounds, show_state); | 741 views::WidgetDelegate::SaveWindowPlacement(bounds, show_state); |
| 736 shell_window_->SaveWindowPosition(); | 742 shell_window_->SaveWindowPosition(); |
| 737 } | 743 } |
| 738 | 744 |
| 739 // static | 745 // static |
| 740 NativeShellWindow* NativeShellWindow::Create( | 746 NativeShellWindow* NativeShellWindow::Create( |
| 741 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 747 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
| 742 return new ShellWindowViews(shell_window, params); | 748 return new ShellWindowViews(shell_window, params); |
| 743 } | 749 } |
| OLD | NEW |