| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 reference_view = browser_view->GetToolbarView()->app_menu(); | 388 reference_view = browser_view->GetToolbarView()->app_menu(); |
| 389 set_anchor_view(reference_view); | 389 set_anchor_view(reference_view); |
| 390 | 390 |
| 391 SetLayoutManager(new views::FillLayout()); | 391 SetLayoutManager(new views::FillLayout()); |
| 392 AddChildView( | 392 AddChildView( |
| 393 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); | 393 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); |
| 394 views::BubbleDelegateView::CreateBubble(this); | 394 views::BubbleDelegateView::CreateBubble(this); |
| 395 StartFade(true); | 395 StartFade(true); |
| 396 } | 396 } |
| 397 | 397 |
| 398 gfx::Point ExtensionInstalledBubble::GetAnchorPoint() { | 398 gfx::Rect ExtensionInstalledBubble::GetAnchorRect() { |
| 399 // For omnibox keyword bubbles, move the arrow to point to the left edge | 399 // For omnibox keyword bubbles, move the arrow to point to the left edge |
| 400 // of the omnibox, just to the right of the icon. | 400 // of the omnibox, just to the right of the icon. |
| 401 if (type_ == OMNIBOX_KEYWORD) { | 401 if (type_ == OMNIBOX_KEYWORD) { |
| 402 LocationBarView* location_bar_view = | 402 LocationBarView* location_bar_view = |
| 403 BrowserView::GetBrowserViewForBrowser(browser_)->GetLocationBarView(); | 403 BrowserView::GetBrowserViewForBrowser(browser_)->GetLocationBarView(); |
| 404 return location_bar_view->GetLocationEntryOrigin().Add( | 404 return gfx::Rect(location_bar_view->GetLocationEntryOrigin().Add( |
| 405 gfx::Point(0, location_bar_view->location_entry_view()->height())); | 405 gfx::Point(0, location_bar_view->location_entry_view()->height())), |
| 406 gfx::Size()); |
| 406 } | 407 } |
| 407 return views::BubbleDelegateView::GetAnchorPoint(); | 408 return views::BubbleDelegateView::GetAnchorRect(); |
| 408 } | 409 } |
| 409 | 410 |
| 410 views::BubbleBorder::ArrowLocation | 411 views::BubbleBorder::ArrowLocation |
| 411 ExtensionInstalledBubble::GetArrowLocation() const { | 412 ExtensionInstalledBubble::GetArrowLocation() const { |
| 412 return type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : | 413 return type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : |
| 413 views::BubbleBorder::TOP_RIGHT; | 414 views::BubbleBorder::TOP_RIGHT; |
| 414 } | 415 } |
| 415 | 416 |
| 416 void ExtensionInstalledBubble::WindowClosing() { | 417 void ExtensionInstalledBubble::WindowClosing() { |
| 417 if (extension_ && type_ == PAGE_ACTION) { | 418 if (extension_ && type_ == PAGE_ACTION) { |
| 418 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 419 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 419 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 420 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 420 extension_->page_action(), | 421 extension_->page_action(), |
| 421 false); // preview_enabled | 422 false); // preview_enabled |
| 422 } | 423 } |
| 423 } | 424 } |
| OLD | NEW |