OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/settings_api_bubble_helper_views.h" | 5 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
6 | 6 |
7 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h" | 7 #include "chrome/browser/extensions/ntp_overridden_bubble_controller.h" |
8 #include "chrome/browser/extensions/settings_api_bubble_controller.h" | 8 #include "chrome/browser/extensions/settings_api_bubble_controller.h" |
9 #include "chrome/browser/extensions/settings_api_helpers.h" | 9 #include "chrome/browser/extensions/settings_api_helpers.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 void MaybeShowExtensionControlledHomeNotification(Browser* browser) { | 49 void MaybeShowExtensionControlledHomeNotification(Browser* browser) { |
50 #if !defined(OS_WIN) | 50 #if !defined(OS_WIN) |
51 return; | 51 return; |
52 #endif | 52 #endif |
53 | 53 |
54 const Extension* extension = | 54 const Extension* extension = |
55 GetExtensionOverridingHomepage(browser->profile(), NULL); | 55 GetExtensionOverridingHomepage(browser->profile()); |
56 if (extension) { | 56 if (extension) { |
57 // The bubble will try to anchor itself against the home button | 57 // The bubble will try to anchor itself against the home button |
58 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)-> | 58 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)-> |
59 toolbar()->home_button(); | 59 toolbar()->home_button(); |
60 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE, | 60 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE, |
61 extension->id(), | 61 extension->id(), |
62 browser->profile(), | 62 browser->profile(), |
63 anchor_view, | 63 anchor_view, |
64 views::BubbleBorder::TOP_LEFT); | 64 views::BubbleBorder::TOP_LEFT); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 void MaybeShowExtensionControlledSearchNotification( | 68 void MaybeShowExtensionControlledSearchNotification( |
69 Profile* profile, | 69 Profile* profile, |
70 content::WebContents* web_contents, | 70 content::WebContents* web_contents, |
71 const AutocompleteMatch& match) { | 71 const AutocompleteMatch& match) { |
72 #if !defined(OS_WIN) | 72 #if !defined(OS_WIN) |
73 return; | 73 return; |
74 #endif | 74 #endif |
75 | 75 |
76 if (AutocompleteMatch::IsSearchType(match.type) && | 76 if (AutocompleteMatch::IsSearchType(match.type) && |
77 match.type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) { | 77 match.type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) { |
78 const Extension* extension = | 78 const Extension* extension = GetExtensionOverridingSearchEngine(profile); |
79 GetExtensionOverridingSearchEngine(profile, NULL); | |
80 if (extension) { | 79 if (extension) { |
81 ToolbarView* toolbar = | 80 ToolbarView* toolbar = |
82 BrowserView::GetBrowserViewForBrowser( | 81 BrowserView::GetBrowserViewForBrowser( |
83 chrome::FindBrowserWithWebContents(web_contents))->toolbar(); | 82 chrome::FindBrowserWithWebContents(web_contents))->toolbar(); |
84 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, | 83 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, |
85 extension->id(), | 84 extension->id(), |
86 profile, | 85 profile, |
87 toolbar->app_menu(), | 86 toolbar->app_menu(), |
88 views::BubbleBorder::TOP_RIGHT); | 87 views::BubbleBorder::TOP_RIGHT); |
89 } | 88 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 new ExtensionMessageBubbleView( | 123 new ExtensionMessageBubbleView( |
125 BrowserView::GetBrowserViewForBrowser(browser)->toolbar()->app_menu(), | 124 BrowserView::GetBrowserViewForBrowser(browser)->toolbar()->app_menu(), |
126 views::BubbleBorder::TOP_RIGHT, | 125 views::BubbleBorder::TOP_RIGHT, |
127 ntp_overridden_bubble.PassAs< | 126 ntp_overridden_bubble.PassAs< |
128 ExtensionMessageBubbleController>()); | 127 ExtensionMessageBubbleController>()); |
129 views::BubbleDelegateView::CreateBubble(bubble_delegate); | 128 views::BubbleDelegateView::CreateBubble(bubble_delegate); |
130 controller->Show(bubble_delegate); | 129 controller->Show(bubble_delegate); |
131 } | 130 } |
132 | 131 |
133 } // namespace extensions | 132 } // namespace extensions |
OLD | NEW |