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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 reference_view = browser_view->GetToolbarView()->app_menu(); | 390 reference_view = browser_view->GetToolbarView()->app_menu(); |
391 set_anchor_view(reference_view); | 391 set_anchor_view(reference_view); |
392 | 392 |
393 SetLayoutManager(new views::FillLayout()); | 393 SetLayoutManager(new views::FillLayout()); |
394 AddChildView( | 394 AddChildView( |
395 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); | 395 new InstalledBubbleContent(browser_, extension_, type_, &icon_, this)); |
396 browser::CreateViewsBubble(this); | 396 browser::CreateViewsBubble(this); |
397 StartFade(true); | 397 StartFade(true); |
398 } | 398 } |
399 | 399 |
400 gfx::Point ExtensionInstalledBubble::GetAnchorPoint() { | 400 gfx::Rect ExtensionInstalledBubble::GetAnchorRect() { |
401 // For omnibox keyword bubbles, move the arrow to point to the left edge | 401 // For omnibox keyword bubbles, move the arrow to point to the left edge |
402 // of the omnibox, just to the right of the icon. | 402 // of the omnibox, just to the right of the icon. |
403 if (type_ == OMNIBOX_KEYWORD) { | 403 if (type_ == OMNIBOX_KEYWORD) { |
404 LocationBarView* location_bar_view = | 404 LocationBarView* location_bar_view = |
405 BrowserView::GetBrowserViewForBrowser(browser_)->GetLocationBarView(); | 405 BrowserView::GetBrowserViewForBrowser(browser_)->GetLocationBarView(); |
406 return location_bar_view->GetLocationEntryOrigin().Add( | 406 return gfx::Rect(location_bar_view->GetLocationEntryOrigin().Add( |
407 gfx::Point(0, location_bar_view->location_entry_view()->height())); | 407 gfx::Point(0, location_bar_view->location_entry_view()->height())), |
| 408 gfx::Size()); |
408 } | 409 } |
409 return views::BubbleDelegateView::GetAnchorPoint(); | 410 return views::BubbleDelegateView::GetAnchorRect(); |
410 } | 411 } |
411 | 412 |
412 views::BubbleBorder::ArrowLocation | 413 views::BubbleBorder::ArrowLocation |
413 ExtensionInstalledBubble::GetArrowLocation() const { | 414 ExtensionInstalledBubble::GetArrowLocation() const { |
414 return type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : | 415 return type_ == OMNIBOX_KEYWORD ? views::BubbleBorder::TOP_LEFT : |
415 views::BubbleBorder::TOP_RIGHT; | 416 views::BubbleBorder::TOP_RIGHT; |
416 } | 417 } |
417 | 418 |
418 void ExtensionInstalledBubble::WindowClosing() { | 419 void ExtensionInstalledBubble::WindowClosing() { |
419 if (extension_ && type_ == PAGE_ACTION) { | 420 if (extension_ && type_ == PAGE_ACTION) { |
420 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 421 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
421 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 422 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
422 extension_->page_action(), | 423 extension_->page_action(), |
423 false); // preview_enabled | 424 false); // preview_enabled |
424 } | 425 } |
425 } | 426 } |
OLD | NEW |