| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extension_installed_bubble_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 366 } |
| 367 | 367 |
| 368 // The link is drawn separately; make it transparent here to only draw once. | 368 // The link is drawn separately; make it transparent here to only draw once. |
| 369 // The link always leads other text and is assumed to fit on the first line. | 369 // The link always leads other text and is assumed to fit on the first line. |
| 370 sign_in_promo_lines_.front()->ApplyColor(SK_ColorTRANSPARENT, | 370 sign_in_promo_lines_.front()->ApplyColor(SK_ColorTRANSPARENT, |
| 371 gfx::Range(0, signin_promo_link_text_.size())); | 371 gfx::Range(0, signin_promo_link_text_.size())); |
| 372 | 372 |
| 373 return height; | 373 return height; |
| 374 } | 374 } |
| 375 | 375 |
| 376 virtual gfx::Size GetPreferredSize() OVERRIDE { | 376 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
| 377 int width = kHorizOuterMargin; | 377 int width = kHorizOuterMargin; |
| 378 width += kIconSize; | 378 width += kIconSize; |
| 379 width += views::kPanelHorizMargin; | 379 width += views::kPanelHorizMargin; |
| 380 width += kRightColumnWidth; | 380 width += kRightColumnWidth; |
| 381 width += 2 * views::kPanelHorizMargin; | 381 width += 2 * views::kPanelHorizMargin; |
| 382 width += kHorizOuterMargin; | 382 width += kHorizOuterMargin; |
| 383 | 383 |
| 384 int height = kVertOuterMargin; | 384 int height = kVertOuterMargin; |
| 385 height += heading_->GetHeightForWidth(kRightColumnWidth); | 385 height += heading_->GetHeightForWidth(kRightColumnWidth); |
| 386 height += kVertInnerMargin; | 386 height += kVertInnerMargin; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 576 |
| 577 views::BubbleDelegateView::CreateBubble(this)->Show(); | 577 views::BubbleDelegateView::CreateBubble(this)->Show(); |
| 578 | 578 |
| 579 // The bubble widget is now the parent and owner of |this| and takes care of | 579 // The bubble widget is now the parent and owner of |this| and takes care of |
| 580 // deletion when the bubble or browser go away. | 580 // deletion when the bubble or browser go away. |
| 581 bubble_.IgnoreBrowserClosing(); | 581 bubble_.IgnoreBrowserClosing(); |
| 582 | 582 |
| 583 return true; | 583 return true; |
| 584 } | 584 } |
| 585 | 585 |
| 586 gfx::Rect ExtensionInstalledBubbleView::GetAnchorRect() { | 586 gfx::Rect ExtensionInstalledBubbleView::GetAnchorRect() const { |
| 587 // For omnibox keyword bubbles, move the arrow to point to the left edge | 587 // For omnibox keyword bubbles, move the arrow to point to the left edge |
| 588 // of the omnibox, just to the right of the icon. | 588 // of the omnibox, just to the right of the icon. |
| 589 if (bubble_.type() == bubble_.OMNIBOX_KEYWORD) { | 589 if (bubble_.type() == bubble_.OMNIBOX_KEYWORD) { |
| 590 LocationBarView* location_bar_view = | 590 const LocationBarView* location_bar_view = |
| 591 BrowserView::GetBrowserViewForBrowser(bubble_.browser())-> | 591 BrowserView::GetBrowserViewForBrowser(bubble_.browser())-> |
| 592 GetLocationBarView(); | 592 GetLocationBarView(); |
| 593 return gfx::Rect(location_bar_view->GetOmniboxViewOrigin(), | 593 return gfx::Rect(location_bar_view->GetOmniboxViewOrigin(), |
| 594 gfx::Size(0, location_bar_view->omnibox_view()->height())); | 594 gfx::Size(0, location_bar_view->omnibox_view()->height())); |
| 595 } | 595 } |
| 596 return views::BubbleDelegateView::GetAnchorRect(); | 596 return views::BubbleDelegateView::GetAnchorRect(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void ExtensionInstalledBubbleView::WindowClosing() { | 599 void ExtensionInstalledBubbleView::WindowClosing() { |
| 600 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { | 600 if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION) { |
| 601 BrowserView* browser_view = | 601 BrowserView* browser_view = |
| 602 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); | 602 BrowserView::GetBrowserViewForBrowser(bubble_.browser()); |
| 603 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 603 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 604 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> | 604 extensions::ExtensionActionManager::Get(bubble_.browser()->profile())-> |
| 605 GetPageAction(*bubble_.extension()), | 605 GetPageAction(*bubble_.extension()), |
| 606 false); // preview_enabled | 606 false); // preview_enabled |
| 607 } | 607 } |
| 608 } | 608 } |
| OLD | NEW |