OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 browser_.reset(); | 467 browser_.reset(); |
468 } | 468 } |
469 | 469 |
470 void BrowserView::Init(Browser* browser) { | 470 void BrowserView::Init(Browser* browser) { |
471 browser_.reset(browser); | 471 browser_.reset(browser); |
472 browser_->tab_strip_model()->AddObserver(this); | 472 browser_->tab_strip_model()->AddObserver(this); |
473 immersive_mode_controller_.reset(chrome::CreateImmersiveModeController()); | 473 immersive_mode_controller_.reset(chrome::CreateImmersiveModeController()); |
474 } | 474 } |
475 | 475 |
476 // static | 476 // static |
| 477 BrowserWindow* BrowserWindow::GetBrowserWindowForNativeWindow( |
| 478 gfx::NativeWindow window) { |
| 479 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); |
| 480 return widget ? reinterpret_cast<BrowserWindow*>( |
| 481 widget->GetNativeWindowProperty(kBrowserViewKey)) |
| 482 : nullptr; |
| 483 } |
| 484 |
| 485 // static |
477 BrowserView* BrowserView::GetBrowserViewForNativeWindow( | 486 BrowserView* BrowserView::GetBrowserViewForNativeWindow( |
478 gfx::NativeWindow window) { | 487 gfx::NativeWindow window) { |
479 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | 488 BrowserWindow* browser_window = |
480 return widget ? | 489 BrowserWindow::GetBrowserWindowForNativeWindow(window); |
481 reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty( | 490 return browser_window ? reinterpret_cast<BrowserView*>(browser_window) |
482 kBrowserViewKey)) : nullptr; | 491 : nullptr; |
483 } | 492 } |
484 | 493 |
485 // static | 494 // static |
486 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { | 495 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { |
487 return static_cast<BrowserView*>(browser->window()); | 496 return static_cast<BrowserView*>(browser->window()); |
488 } | 497 } |
489 | 498 |
490 // static | 499 // static |
491 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas, | 500 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas, |
492 SkColor color, | 501 SkColor color, |
(...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 } | 2676 } |
2668 | 2677 |
2669 extensions::ActiveTabPermissionGranter* | 2678 extensions::ActiveTabPermissionGranter* |
2670 BrowserView::GetActiveTabPermissionGranter() { | 2679 BrowserView::GetActiveTabPermissionGranter() { |
2671 content::WebContents* web_contents = GetActiveWebContents(); | 2680 content::WebContents* web_contents = GetActiveWebContents(); |
2672 if (!web_contents) | 2681 if (!web_contents) |
2673 return nullptr; | 2682 return nullptr; |
2674 return extensions::TabHelper::FromWebContents(web_contents) | 2683 return extensions::TabHelper::FromWebContents(web_contents) |
2675 ->active_tab_permission_granter(); | 2684 ->active_tab_permission_granter(); |
2676 } | 2685 } |
OLD | NEW |