| 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/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" | |
| 12 #include "chrome/browser/ui/panels/native_panel.h" | 11 #include "chrome/browser/ui/panels/native_panel.h" |
| 12 #include "chrome/browser/ui/panels/panel_browser_window.h" |
| 13 #include "chrome/browser/ui/panels/panel_manager.h" | 13 #include "chrome/browser/ui/panels/panel_manager.h" |
| 14 #include "chrome/browser/ui/panels/panel_strip.h" | 14 #include "chrome/browser/ui/panels/panel_strip.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
| 17 #include "chrome/browser/ui/window_sizer.h" | |
| 18 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 20 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 24 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| 25 | 22 |
| 26 #if defined(USE_AURA) | |
| 27 #include "chrome/browser/ui/panels/panel_browser_view.h" | |
| 28 #endif | |
| 29 | |
| 30 using content::NativeWebKeyboardEvent; | |
| 31 using content::RenderViewHost; | 23 using content::RenderViewHost; |
| 32 using content::SSLStatus; | |
| 33 using content::WebContents; | 24 using content::WebContents; |
| 34 | 25 |
| 35 Panel::Panel(Browser* browser, const gfx::Size& requested_size) | 26 Panel::Panel(Browser* browser, const gfx::Size& requested_size) |
| 36 : browser_(browser), | 27 : browser_(browser), |
| 37 panel_strip_(NULL), | 28 panel_strip_(NULL), |
| 38 initialized_(false), | 29 initialized_(false), |
| 39 full_size_(requested_size), | 30 full_size_(requested_size), |
| 40 max_size_policy_(DEFAULT_MAX_SIZE), | 31 max_size_policy_(DEFAULT_MAX_SIZE), |
| 41 auto_resizable_(false), | 32 auto_resizable_(false), |
| 42 always_on_top_(false), | 33 always_on_top_(false), |
| 43 in_preview_mode_(false), | 34 in_preview_mode_(false), |
| 44 native_panel_(NULL), | 35 native_panel_(NULL), |
| 45 attention_mode_(USE_PANEL_ATTENTION), | 36 attention_mode_(USE_PANEL_ATTENTION), |
| 46 expansion_state_(EXPANDED) { | 37 expansion_state_(EXPANDED) { |
| 47 } | 38 } |
| 48 | 39 |
| 49 Panel::~Panel() { | 40 Panel::~Panel() { |
| 50 // Invoked by native panel destructor. Do not access native_panel_ here. | 41 // Invoked by native panel destructor. Do not access native_panel_ here. |
| 51 } | 42 } |
| 52 | 43 |
| 53 void Panel::Initialize(const gfx::Rect& bounds) { | 44 void Panel::Initialize(const gfx::Rect& bounds) { |
| 54 DCHECK(!initialized_); | 45 DCHECK(!initialized_); |
| 55 DCHECK(!bounds.IsEmpty()); | 46 DCHECK(!bounds.IsEmpty()); |
| 56 initialized_ = true; | 47 initialized_ = true; |
| 57 native_panel_ = CreateNativePanel(browser_, this, bounds); | 48 native_panel_ = CreateNativePanel(browser_, this, bounds); |
| 49 panel_browser_window_.reset( |
| 50 new PanelBrowserWindow(browser_, this, native_panel_)); |
| 58 if (panel_strip_ != NULL) | 51 if (panel_strip_ != NULL) |
| 59 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); | 52 native_panel_->PreventActivationByOS(panel_strip_->IsPanelMinimized(this)); |
| 60 } | 53 } |
| 61 | 54 |
| 62 void Panel::OnNativePanelClosed() { | 55 void Panel::OnNativePanelClosed() { |
| 63 if (auto_resizable_) | |
| 64 native_panel_->GetPanelBrowser()->tab_strip_model()->RemoveObserver(this); | |
| 65 manager()->OnPanelClosed(this); | 56 manager()->OnPanelClosed(this); |
| 66 DCHECK(!panel_strip_); | 57 DCHECK(!panel_strip_); |
| 67 } | 58 } |
| 68 | 59 |
| 69 PanelManager* Panel::manager() const { | 60 PanelManager* Panel::manager() const { |
| 70 return PanelManager::GetInstance(); | 61 return PanelManager::GetInstance(); |
| 71 } | 62 } |
| 72 | 63 |
| 64 BrowserWindow* Panel::browser_window() const { |
| 65 return panel_browser_window_.get(); |
| 66 } |
| 67 |
| 73 bool Panel::CanMinimize() const { | 68 bool Panel::CanMinimize() const { |
| 74 return panel_strip_ && panel_strip_->CanMinimizePanel(this) && !IsMinimized(); | 69 return panel_strip_ && panel_strip_->CanMinimizePanel(this) && !IsMinimized(); |
| 75 } | 70 } |
| 76 | 71 |
| 77 bool Panel::CanRestore() const { | 72 bool Panel::CanRestore() const { |
| 78 return panel_strip_ && panel_strip_->CanMinimizePanel(this) && IsMinimized(); | 73 return panel_strip_ && panel_strip_->CanMinimizePanel(this) && IsMinimized(); |
| 79 } | 74 } |
| 80 | 75 |
| 81 panel::Resizability Panel::CanResizeByMouse() const { | 76 panel::Resizability Panel::CanResizeByMouse() const { |
| 82 if (!panel_strip_) | 77 if (!panel_strip_) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 full_size_ = ClampSize(full_size_); | 119 full_size_ = ClampSize(full_size_); |
| 125 } | 120 } |
| 126 | 121 |
| 127 void Panel::SetAutoResizable(bool resizable) { | 122 void Panel::SetAutoResizable(bool resizable) { |
| 128 if (auto_resizable_ == resizable) | 123 if (auto_resizable_ == resizable) |
| 129 return; | 124 return; |
| 130 | 125 |
| 131 auto_resizable_ = resizable; | 126 auto_resizable_ = resizable; |
| 132 WebContents* web_contents = browser()->GetSelectedWebContents(); | 127 WebContents* web_contents = browser()->GetSelectedWebContents(); |
| 133 if (auto_resizable_) { | 128 if (auto_resizable_) { |
| 134 browser()->tab_strip_model()->AddObserver(this); | |
| 135 if (web_contents) | 129 if (web_contents) |
| 136 EnableWebContentsAutoResize(web_contents); | 130 EnableWebContentsAutoResize(web_contents); |
| 137 } else { | 131 } else { |
| 138 browser()->tab_strip_model()->RemoveObserver(this); | |
| 139 registrar_.RemoveAll(); | 132 registrar_.RemoveAll(); |
| 140 | 133 |
| 141 if (web_contents) { | 134 if (web_contents) { |
| 142 // NULL might be returned if the tab has not been added. | 135 // NULL might be returned if the tab has not been added. |
| 143 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); | 136 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); |
| 144 if (render_view_host) | 137 if (render_view_host) |
| 145 render_view_host->DisableAutoResize(full_size_); | 138 render_view_host->DisableAutoResize(full_size_); |
| 146 } | 139 } |
| 147 } | 140 } |
| 148 } | 141 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 262 } |
| 270 | 263 |
| 271 void Panel::Deactivate() { | 264 void Panel::Deactivate() { |
| 272 native_panel_->DeactivatePanel(); | 265 native_panel_->DeactivatePanel(); |
| 273 } | 266 } |
| 274 | 267 |
| 275 bool Panel::IsActive() const { | 268 bool Panel::IsActive() const { |
| 276 return native_panel_->IsPanelActive(); | 269 return native_panel_->IsPanelActive(); |
| 277 } | 270 } |
| 278 | 271 |
| 272 void Panel::SetDraggableRegion(SkRegion* region) { |
| 273 } |
| 274 |
| 279 void Panel::FlashFrame(bool draw_attention) { | 275 void Panel::FlashFrame(bool draw_attention) { |
| 280 if (IsDrawingAttention() == draw_attention || !panel_strip_) | 276 if (IsDrawingAttention() == draw_attention || !panel_strip_) |
| 281 return; | 277 return; |
| 282 | 278 |
| 283 // Don't draw attention for an active panel. | 279 // Don't draw attention for an active panel. |
| 284 if (draw_attention && IsActive()) | 280 if (draw_attention && IsActive()) |
| 285 return; | 281 return; |
| 286 | 282 |
| 287 // Invoking native panel to draw attention must be done before informing the | 283 // Invoking native panel to draw attention must be done before informing the |
| 288 // panel strip because it needs to check internal state of the panel to | 284 // panel strip because it needs to check internal state of the panel to |
| 289 // determine if the panel has been drawing attention. | 285 // determine if the panel has been drawing attention. |
| 290 native_panel_->DrawAttention(draw_attention); | 286 native_panel_->DrawAttention(draw_attention); |
| 291 panel_strip_->OnPanelAttentionStateChanged(this); | 287 panel_strip_->OnPanelAttentionStateChanged(this); |
| 292 } | 288 } |
| 293 | 289 |
| 294 bool Panel::IsAlwaysOnTop() const { | 290 bool Panel::IsAlwaysOnTop() const { |
| 295 return always_on_top_; | 291 return always_on_top_; |
| 296 } | 292 } |
| 297 | 293 |
| 298 gfx::NativeWindow Panel::GetNativeHandle() { | |
| 299 return native_panel_->GetNativePanelHandle(); | |
| 300 } | |
| 301 | |
| 302 BrowserWindowTesting* Panel::GetBrowserWindowTesting() { | |
| 303 NOTIMPLEMENTED(); | |
| 304 return NULL; | |
| 305 } | |
| 306 | |
| 307 StatusBubble* Panel::GetStatusBubble() { | |
| 308 // TODO(jennb): Implement. http://crbug.com/102723 | |
| 309 return NULL; | |
| 310 } | |
| 311 | |
| 312 void Panel::ToolbarSizeChanged(bool is_animating){ | |
| 313 NOTIMPLEMENTED(); | |
| 314 } | |
| 315 | |
| 316 void Panel::UpdateTitleBar() { | |
| 317 native_panel_->UpdatePanelTitleBar(); | |
| 318 } | |
| 319 | |
| 320 void Panel::BookmarkBarStateChanged( | |
| 321 BookmarkBar::AnimateChangeType change_type) { | |
| 322 NOTIMPLEMENTED(); | |
| 323 } | |
| 324 | |
| 325 void Panel::UpdateDevTools() { | |
| 326 NOTIMPLEMENTED(); | |
| 327 } | |
| 328 | |
| 329 void Panel::SetDevToolsDockSide(DevToolsDockSide side) { | |
| 330 NOTIMPLEMENTED(); | |
| 331 } | |
| 332 | |
| 333 void Panel::UpdateLoadingAnimations(bool should_animate) { | |
| 334 native_panel_->UpdatePanelLoadingAnimations(should_animate); | |
| 335 } | |
| 336 | |
| 337 void Panel::SetStarredState(bool is_starred) { | |
| 338 // Since panels are typically not bookmarked extension UI windows, they don't | |
| 339 // have starred state. | |
| 340 } | |
| 341 | |
| 342 gfx::Rect Panel::GetRestoredBounds() const { | 294 gfx::Rect Panel::GetRestoredBounds() const { |
| 343 gfx::Rect bounds = native_panel_->GetPanelBounds(); | 295 gfx::Rect bounds = native_panel_->GetPanelBounds(); |
| 344 bounds.set_y(bounds.bottom() - full_size_.height()); | 296 bounds.set_y(bounds.bottom() - full_size_.height()); |
| 345 bounds.set_x(bounds.right() - full_size_.width()); | 297 bounds.set_x(bounds.right() - full_size_.width()); |
| 346 bounds.set_size(full_size_); | 298 bounds.set_size(full_size_); |
| 347 return bounds; | 299 return bounds; |
| 348 } | 300 } |
| 349 | 301 |
| 350 gfx::Rect Panel::GetBounds() const { | 302 gfx::Rect Panel::GetBounds() const { |
| 351 return native_panel_->GetPanelBounds(); | 303 return native_panel_->GetPanelBounds(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 375 void Panel::Minimize() { | 327 void Panel::Minimize() { |
| 376 if (panel_strip_) | 328 if (panel_strip_) |
| 377 panel_strip_->MinimizePanel(this); | 329 panel_strip_->MinimizePanel(this); |
| 378 } | 330 } |
| 379 | 331 |
| 380 void Panel::Restore() { | 332 void Panel::Restore() { |
| 381 if (panel_strip_) | 333 if (panel_strip_) |
| 382 panel_strip_->RestorePanel(this); | 334 panel_strip_->RestorePanel(this); |
| 383 } | 335 } |
| 384 | 336 |
| 385 void Panel::EnterFullscreen( | |
| 386 const GURL& url, FullscreenExitBubbleType type) { | |
| 387 NOTIMPLEMENTED(); | |
| 388 } | |
| 389 | |
| 390 void Panel::ExitFullscreen() { | |
| 391 NOTIMPLEMENTED(); | |
| 392 } | |
| 393 | |
| 394 void Panel::UpdateFullscreenExitBubbleContent( | |
| 395 const GURL& url, | |
| 396 FullscreenExitBubbleType bubble_type) { | |
| 397 NOTIMPLEMENTED(); | |
| 398 } | |
| 399 | |
| 400 bool Panel::IsFullscreen() const { | 337 bool Panel::IsFullscreen() const { |
| 401 return false; | 338 return false; |
| 402 } | 339 } |
| 403 | 340 |
| 404 bool Panel::IsFullscreenBubbleVisible() const { | 341 void Panel::OnWindowAutoResized(const gfx::Size& preferred_window_size) { |
| 405 NOTIMPLEMENTED(); | |
| 406 return false; | |
| 407 } | |
| 408 | |
| 409 LocationBar* Panel::GetLocationBar() const { | |
| 410 #if defined(USE_AURA) | |
| 411 // TODO(stevenjb): Remove this when Aura panels are implemented post R18. | |
| 412 PanelBrowserView* panel_view = static_cast<PanelBrowserView*>(native_panel_); | |
| 413 return panel_view->GetLocationBar(); | |
| 414 #else | |
| 415 // Panels do not have a location bar. | |
| 416 return NULL; | |
| 417 #endif | |
| 418 } | |
| 419 | |
| 420 void Panel::SetFocusToLocationBar(bool select_all) { | |
| 421 #if defined(USE_AURA) | |
| 422 // TODO(stevenjb): Remove this when Aura panels are implemented post R18. | |
| 423 PanelBrowserView* panel_view = static_cast<PanelBrowserView*>(native_panel_); | |
| 424 panel_view->SetFocusToLocationBar(select_all); | |
| 425 #else | |
| 426 // Panels do not have a location bar. | |
| 427 #endif | |
| 428 } | |
| 429 | |
| 430 void Panel::UpdateReloadStopState(bool is_loading, bool force) { | |
| 431 // Panels don't have stop/reload indicator. | |
| 432 } | |
| 433 | |
| 434 void Panel::UpdateToolbar(TabContentsWrapper* contents, | |
| 435 bool should_restore_state) { | |
| 436 // Panels do not have a toolbar. | |
| 437 } | |
| 438 | |
| 439 void Panel::FocusToolbar() { | |
| 440 // Panels do not have a toolbar. | |
| 441 } | |
| 442 | |
| 443 void Panel::FocusAppMenu() { | |
| 444 NOTIMPLEMENTED(); | |
| 445 } | |
| 446 | |
| 447 void Panel::FocusBookmarksToolbar() { | |
| 448 NOTIMPLEMENTED(); | |
| 449 } | |
| 450 | |
| 451 void Panel::RotatePaneFocus(bool forwards) { | |
| 452 NOTIMPLEMENTED(); | |
| 453 } | |
| 454 | |
| 455 bool Panel::IsBookmarkBarVisible() const { | |
| 456 return false; | |
| 457 } | |
| 458 | |
| 459 bool Panel::IsBookmarkBarAnimating() const { | |
| 460 return false; | |
| 461 } | |
| 462 | |
| 463 // This is used by extensions to decide if a window can be closed. | |
| 464 // Always return true as panels do not have tabs that can be dragged, | |
| 465 // during which extensions will avoid closing a window. | |
| 466 bool Panel::IsTabStripEditable() const { | |
| 467 return true; | |
| 468 } | |
| 469 | |
| 470 bool Panel::IsToolbarVisible() const { | |
| 471 NOTIMPLEMENTED(); | |
| 472 return false; | |
| 473 } | |
| 474 | |
| 475 gfx::Rect Panel::GetRootWindowResizerRect() const { | |
| 476 return gfx::Rect(); | |
| 477 } | |
| 478 | |
| 479 bool Panel::IsPanel() const { | |
| 480 return true; | |
| 481 } | |
| 482 | |
| 483 void Panel::DisableInactiveFrame() { | |
| 484 NOTIMPLEMENTED(); | |
| 485 } | |
| 486 | |
| 487 void Panel::ConfirmAddSearchProvider(TemplateURL* template_url, | |
| 488 Profile* profile) { | |
| 489 NOTIMPLEMENTED(); | |
| 490 } | |
| 491 | |
| 492 void Panel::ToggleBookmarkBar() { | |
| 493 NOTIMPLEMENTED(); | |
| 494 } | |
| 495 | |
| 496 void Panel::ShowAboutChromeDialog() { | |
| 497 NOTIMPLEMENTED(); | |
| 498 } | |
| 499 | |
| 500 void Panel::ShowUpdateChromeDialog() { | |
| 501 NOTIMPLEMENTED(); | |
| 502 } | |
| 503 | |
| 504 void Panel::ShowTaskManager() { | |
| 505 native_panel_->ShowTaskManagerForPanel(); | |
| 506 } | |
| 507 | |
| 508 void Panel::ShowBackgroundPages() { | |
| 509 NOTIMPLEMENTED(); | |
| 510 } | |
| 511 | |
| 512 void Panel::ShowBookmarkBubble(const GURL& url, bool already_bookmarked) { | |
| 513 NOTIMPLEMENTED(); | |
| 514 } | |
| 515 | |
| 516 void Panel::ShowChromeToMobileBubble() { | |
| 517 NOTIMPLEMENTED(); | |
| 518 } | |
| 519 | |
| 520 #if defined(ENABLE_ONE_CLICK_SIGNIN) | |
| 521 void Panel::ShowOneClickSigninBubble( | |
| 522 const base::Closure& learn_more_callback, | |
| 523 const base::Closure& advanced_callback) { | |
| 524 NOTIMPLEMENTED(); | |
| 525 } | |
| 526 #endif | |
| 527 | |
| 528 bool Panel::IsDownloadShelfVisible() const { | |
| 529 return false; | |
| 530 } | |
| 531 | |
| 532 DownloadShelf* Panel::GetDownloadShelf() { | |
| 533 Browser* panel_browser = native_panel_->GetPanelBrowser(); | |
| 534 Profile* profile = panel_browser->profile(); | |
| 535 Browser* tabbed_browser = browser::FindTabbedBrowser(profile, true); | |
| 536 | |
| 537 if (!tabbed_browser) { | |
| 538 // Set initial bounds so window will not be positioned at an offset | |
| 539 // to this panel as panels are at the bottom of the screen. | |
| 540 gfx::Rect window_bounds; | |
| 541 WindowSizer::GetBrowserWindowBounds(std::string(), gfx::Rect(), | |
| 542 panel_browser, &window_bounds); | |
| 543 Browser::CreateParams params(Browser::TYPE_TABBED, profile); | |
| 544 params.initial_bounds = window_bounds; | |
| 545 tabbed_browser = Browser::CreateWithParams(params); | |
| 546 tabbed_browser->NewTab(); | |
| 547 } | |
| 548 | |
| 549 tabbed_browser->window()->Show(); // Ensure download shelf is visible. | |
| 550 return tabbed_browser->window()->GetDownloadShelf(); | |
| 551 } | |
| 552 | |
| 553 void Panel::ConfirmBrowserCloseWithPendingDownloads() { | |
| 554 NOTIMPLEMENTED(); | |
| 555 } | |
| 556 | |
| 557 void Panel::UserChangedTheme() { | |
| 558 native_panel_->NotifyPanelOnUserChangedTheme(); | |
| 559 } | |
| 560 | |
| 561 int Panel::GetExtraRenderViewHeight() const { | |
| 562 // This is currently used only on Linux and that returns the height for | |
| 563 // optional elements like bookmark bar, download bar etc. Not applicable to | |
| 564 // panels. | |
| 565 return 0; | |
| 566 } | |
| 567 | |
| 568 void Panel::WebContentsFocused(WebContents* contents) { | |
| 569 native_panel_->PanelWebContentsFocused(contents); | |
| 570 } | |
| 571 | |
| 572 void Panel::ShowPageInfo(Profile* profile, | |
| 573 const GURL& url, | |
| 574 const SSLStatus& ssl, | |
| 575 bool show_history) { | |
| 576 NOTIMPLEMENTED(); | |
| 577 } | |
| 578 void Panel::ShowWebsiteSettings(Profile* profile, | |
| 579 TabContentsWrapper* tab_contents_wrapper, | |
| 580 const GURL& url, | |
| 581 const content::SSLStatus& ssl, | |
| 582 bool show_history) { | |
| 583 NOTIMPLEMENTED(); | |
| 584 } | |
| 585 | |
| 586 void Panel::ShowAppMenu() { | |
| 587 NOTIMPLEMENTED(); | |
| 588 } | |
| 589 | |
| 590 bool Panel::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | |
| 591 bool* is_keyboard_shortcut) { | |
| 592 return native_panel_->PreHandlePanelKeyboardEvent(event, | |
| 593 is_keyboard_shortcut); | |
| 594 } | |
| 595 | |
| 596 void Panel::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | |
| 597 native_panel_->HandlePanelKeyboardEvent(event); | |
| 598 } | |
| 599 | |
| 600 void Panel::ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents) { | |
| 601 NOTIMPLEMENTED(); | |
| 602 } | |
| 603 | |
| 604 void Panel::ShowCreateChromeAppShortcutsDialog(Profile* profile, | |
| 605 const extensions::Extension* app) { | |
| 606 NOTIMPLEMENTED(); | |
| 607 } | |
| 608 | |
| 609 void Panel::Cut() { | |
| 610 native_panel_->PanelCut(); | |
| 611 } | |
| 612 | |
| 613 void Panel::Copy() { | |
| 614 native_panel_->PanelCopy(); | |
| 615 } | |
| 616 | |
| 617 void Panel::Paste() { | |
| 618 native_panel_->PanelPaste(); | |
| 619 } | |
| 620 | |
| 621 #if defined(OS_MACOSX) | |
| 622 void Panel::OpenTabpose() { | |
| 623 NOTIMPLEMENTED(); | |
| 624 } | |
| 625 | |
| 626 void Panel::EnterPresentationMode( | |
| 627 const GURL& url, | |
| 628 FullscreenExitBubbleType content_type) { | |
| 629 NOTIMPLEMENTED(); | |
| 630 } | |
| 631 | |
| 632 void Panel::ExitPresentationMode() { | |
| 633 NOTIMPLEMENTED(); | |
| 634 } | |
| 635 | |
| 636 bool Panel::InPresentationMode() { | |
| 637 NOTIMPLEMENTED(); | |
| 638 return false; | |
| 639 } | |
| 640 #endif | |
| 641 | |
| 642 void Panel::ShowInstant(TabContentsWrapper* preview) { | |
| 643 NOTIMPLEMENTED(); | |
| 644 } | |
| 645 | |
| 646 void Panel::HideInstant() { | |
| 647 NOTIMPLEMENTED(); | |
| 648 } | |
| 649 | |
| 650 gfx::Rect Panel::GetInstantBounds() { | |
| 651 NOTIMPLEMENTED(); | |
| 652 return gfx::Rect(); | |
| 653 } | |
| 654 | |
| 655 WindowOpenDisposition Panel::GetDispositionForPopupBounds( | |
| 656 const gfx::Rect& bounds) { | |
| 657 #if defined(USE_AURA) | |
| 658 // TODO(stevenjb): Remove this when Aura panels are implemented post R18. | |
| 659 PanelBrowserView* panel_view = static_cast<PanelBrowserView*>(native_panel_); | |
| 660 return panel_view->GetDispositionForPopupBounds(bounds); | |
| 661 #else | |
| 662 return NEW_POPUP; | |
| 663 #endif | |
| 664 } | |
| 665 | |
| 666 FindBar* Panel::CreateFindBar() { | |
| 667 return native_panel_->CreatePanelFindBar(); | |
| 668 } | |
| 669 | |
| 670 void Panel::ResizeDueToAutoResize(WebContents* web_contents, | |
| 671 const gfx::Size& pref_size) { | |
| 672 DCHECK(auto_resizable_); | 342 DCHECK(auto_resizable_); |
| 673 return manager()->OnWindowAutoResized( | 343 if (panel_strip_) |
| 674 this, | 344 panel_strip_->ResizePanelWindow(this, preferred_window_size); |
| 675 native_panel_->WindowSizeFromContentSize(pref_size)); | |
| 676 } | |
| 677 | |
| 678 void Panel::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) { | |
| 679 // Panels will never show a new tab page so this should never be called. | |
| 680 NOTREACHED(); | |
| 681 } | |
| 682 | |
| 683 void Panel::ShowAvatarBubbleFromAvatarButton() { | |
| 684 // Panels will never show an avatar button so this should never be called. | |
| 685 NOTREACHED(); | |
| 686 } | |
| 687 | |
| 688 void Panel::TabInsertedAt(TabContentsWrapper* contents, | |
| 689 int index, | |
| 690 bool foreground) { | |
| 691 if (auto_resizable_) { | |
| 692 DCHECK_EQ(0, index); | |
| 693 EnableWebContentsAutoResize(contents->web_contents()); | |
| 694 } | |
| 695 } | 345 } |
| 696 | 346 |
| 697 void Panel::EnableWebContentsAutoResize(WebContents* web_contents) { | 347 void Panel::EnableWebContentsAutoResize(WebContents* web_contents) { |
| 698 DCHECK(web_contents); | 348 DCHECK(web_contents); |
| 699 ConfigureAutoResize(web_contents); | 349 ConfigureAutoResize(web_contents); |
| 700 | 350 |
| 701 // We also need to know when the render view host changes in order | 351 // We also need to know when the render view host changes in order |
| 702 // to turn on auto-resize notifications in the new render view host. | 352 // to turn on auto-resize notifications in the new render view host. |
| 703 registrar_.RemoveAll(); // Stop notifications for previous contents, if any. | 353 registrar_.RemoveAll(); // Stop notifications for previous contents, if any. |
| 704 registrar_.Add( | 354 registrar_.Add( |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 void Panel::OnPanelStartUserResizing() { | 435 void Panel::OnPanelStartUserResizing() { |
| 786 SetAutoResizable(false); | 436 SetAutoResizable(false); |
| 787 SetPreviewMode(true); | 437 SetPreviewMode(true); |
| 788 max_size_policy_ = CUSTOM_MAX_SIZE; | 438 max_size_policy_ = CUSTOM_MAX_SIZE; |
| 789 } | 439 } |
| 790 | 440 |
| 791 void Panel::OnPanelEndUserResizing() { | 441 void Panel::OnPanelEndUserResizing() { |
| 792 SetPreviewMode(false); | 442 SetPreviewMode(false); |
| 793 } | 443 } |
| 794 | 444 |
| 795 void Panel::DestroyBrowser() { | |
| 796 native_panel_->DestroyPanelBrowser(); | |
| 797 } | |
| OLD | NEW |