| 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/native_app_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/native_app_window_views.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 return window_bounds.InsetsFrom(client_bounds); | 406 return window_bounds.InsetsFrom(client_bounds); |
| 407 } | 407 } |
| 408 | 408 |
| 409 gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) { | 409 gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) { |
| 410 gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size(); | 410 gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size(); |
| 411 return gfx::Point(shell_window_size.width() / 2 - size.width() / 2, | 411 return gfx::Point(shell_window_size.width() / 2 - size.width() / 2, |
| 412 shell_window_size.height() / 2 - size.height() / 2); | 412 shell_window_size.height() / 2 - size.height() / 2); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void NativeAppWindowViews::AddObserver( | 415 void NativeAppWindowViews::AddObserver( |
| 416 WebContentsModalDialogHostObserver* observer) { | 416 web_modal::WebContentsModalDialogHostObserver* observer) { |
| 417 observer_list_.AddObserver(observer); | 417 observer_list_.AddObserver(observer); |
| 418 } | 418 } |
| 419 void NativeAppWindowViews::RemoveObserver( | 419 void NativeAppWindowViews::RemoveObserver( |
| 420 WebContentsModalDialogHostObserver* observer) { | 420 web_modal::WebContentsModalDialogHostObserver* observer) { |
| 421 observer_list_.RemoveObserver(observer); | 421 observer_list_.RemoveObserver(observer); |
| 422 } | 422 } |
| 423 | 423 |
| 424 // Private method. TODO(stevenjb): Move this below InitializePanelWindow() | 424 // Private method. TODO(stevenjb): Move this below InitializePanelWindow() |
| 425 // to match declaration order. | 425 // to match declaration order. |
| 426 void NativeAppWindowViews::OnViewWasResized() { | 426 void NativeAppWindowViews::OnViewWasResized() { |
| 427 // TODO(jeremya): this doesn't seem like a terribly elegant way to keep the | 427 // TODO(jeremya): this doesn't seem like a terribly elegant way to keep the |
| 428 // window shape in sync. | 428 // window shape in sync. |
| 429 #if defined(OS_WIN) && !defined(USE_AURA) | 429 #if defined(OS_WIN) && !defined(USE_AURA) |
| 430 DCHECK(window_); | 430 DCHECK(window_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 rgn->op(width - kResizeInsideBoundsSize, 0, width, height, | 470 rgn->op(width - kResizeInsideBoundsSize, 0, width, height, |
| 471 SkRegion::kUnion_Op); | 471 SkRegion::kUnion_Op); |
| 472 rgn->op(0, height - kResizeInsideBoundsSize, width, height, | 472 rgn->op(0, height - kResizeInsideBoundsSize, width, height, |
| 473 SkRegion::kUnion_Op); | 473 SkRegion::kUnion_Op); |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 if (web_contents()->GetRenderViewHost()->GetView()) | 476 if (web_contents()->GetRenderViewHost()->GetView()) |
| 477 web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn); | 477 web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn); |
| 478 #endif | 478 #endif |
| 479 | 479 |
| 480 FOR_EACH_OBSERVER(WebContentsModalDialogHostObserver, | 480 FOR_EACH_OBSERVER(web_modal::WebContentsModalDialogHostObserver, |
| 481 observer_list_, | 481 observer_list_, |
| 482 OnPositionRequiresUpdate()); | 482 OnPositionRequiresUpdate()); |
| 483 } | 483 } |
| 484 | 484 |
| 485 bool NativeAppWindowViews::ShouldUseChromeStyleFrame() const { | 485 bool NativeAppWindowViews::ShouldUseChromeStyleFrame() const { |
| 486 return !CommandLine::ForCurrentProcess()->HasSwitch( | 486 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 487 switches::kAppsUseNativeFrame) || frameless_; | 487 switches::kAppsUseNativeFrame) || frameless_; |
| 488 } | 488 } |
| 489 | 489 |
| 490 // WidgetDelegate implementation. | 490 // WidgetDelegate implementation. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 739 } |
| 740 | 740 |
| 741 //------------------------------------------------------------------------------ | 741 //------------------------------------------------------------------------------ |
| 742 // NativeAppWindow::Create | 742 // NativeAppWindow::Create |
| 743 | 743 |
| 744 // static | 744 // static |
| 745 NativeAppWindow* NativeAppWindow::Create( | 745 NativeAppWindow* NativeAppWindow::Create( |
| 746 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 746 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
| 747 return new NativeAppWindowViews(shell_window, params); | 747 return new NativeAppWindowViews(shell_window, params); |
| 748 } | 748 } |
| OLD | NEW |