Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(828)

Side by Side Diff: chrome/browser/ui/views/settings_api_bubble_helper_views.cc

Issue 1768623002: [Extension UI Views] Add tests for clicking the different message bubble buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/extensions/ntp_overridden_bubble_delegate.h" 10 #include "chrome/browser/extensions/ntp_overridden_bubble_delegate.h"
11 #include "chrome/browser/extensions/settings_api_bubble_delegate.h" 11 #include "chrome/browser/extensions/settings_api_bubble_delegate.h"
12 #include "chrome/browser/extensions/settings_api_helpers.h" 12 #include "chrome/browser/extensions/settings_api_helpers.h"
13 #include "chrome/browser/ui/browser_finder.h" 13 #include "chrome/browser/ui/browser_finder.h"
14 #include "chrome/browser/ui/extensions/extension_message_bubble_factory.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h" 16 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 17 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 18 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
18 #include "chrome/browser/ui/views/toolbar/home_button.h" 19 #include "chrome/browser/ui/views/toolbar/home_button.h"
19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
20 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h" 21 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/browser_url_handler.h" 23 #include "content/public/browser/browser_url_handler.h"
23 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
(...skipping 15 matching lines...) Expand all
39 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView( 40 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView(
40 anchor_view, arrow, std::move(settings_api_bubble)); 41 anchor_view, arrow, std::move(settings_api_bubble));
41 views::BubbleDelegateView::CreateBubble(bubble); 42 views::BubbleDelegateView::CreateBubble(bubble);
42 bubble->Show(); 43 bubble->Show();
43 } 44 }
44 45
45 } // namespace 46 } // namespace
46 47
47 void MaybeShowExtensionControlledHomeNotification(Browser* browser) { 48 void MaybeShowExtensionControlledHomeNotification(Browser* browser) {
48 #if !defined(OS_WIN) 49 #if !defined(OS_WIN)
49 return; 50 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing())
51 return;
50 #endif 52 #endif
51 53
52 // The bubble will try to anchor itself against the home button 54 // The bubble will try to anchor itself against the home button
53 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)-> 55 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)->
54 toolbar()->home_button(); 56 toolbar()->home_button();
55 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE, 57 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE,
56 browser, 58 browser,
57 anchor_view, 59 anchor_view,
58 views::BubbleBorder::TOP_LEFT); 60 views::BubbleBorder::TOP_LEFT);
59 } 61 }
60 62
61 void MaybeShowExtensionControlledSearchNotification( 63 void MaybeShowExtensionControlledSearchNotification(
62 Profile* profile, 64 Profile* profile,
63 content::WebContents* web_contents, 65 content::WebContents* web_contents,
64 AutocompleteMatch::Type match_type) { 66 AutocompleteMatch::Type match_type) {
65 #if !defined(OS_WIN) 67 #if !defined(OS_WIN)
66 return; 68 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing())
69 return;
67 #endif 70 #endif
68 71
69 if (AutocompleteMatch::IsSearchType(match_type) && 72 if (AutocompleteMatch::IsSearchType(match_type) &&
70 match_type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) { 73 match_type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) {
71 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 74 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
72 ToolbarView* toolbar = 75 ToolbarView* toolbar =
73 BrowserView::GetBrowserViewForBrowser(browser)->toolbar(); 76 BrowserView::GetBrowserViewForBrowser(browser)->toolbar();
74 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, browser, 77 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, browser,
75 toolbar->app_menu_button(), 78 toolbar->app_menu_button(),
76 views::BubbleBorder::TOP_RIGHT); 79 views::BubbleBorder::TOP_RIGHT);
77 } 80 }
78 } 81 }
79 82
80 void MaybeShowExtensionControlledNewTabPage( 83 void MaybeShowExtensionControlledNewTabPage(
81 Browser* browser, content::WebContents* web_contents) { 84 Browser* browser, content::WebContents* web_contents) {
82 #if !defined(OS_WIN) 85 #if !defined(OS_WIN)
83 return; 86 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing())
87 return;
84 #endif 88 #endif
85 89
86 content::NavigationEntry* entry = 90 content::NavigationEntry* entry =
87 web_contents->GetController().GetActiveEntry(); 91 web_contents->GetController().GetActiveEntry();
88 if (!entry) 92 if (!entry)
89 return; 93 return;
90 GURL active_url = entry->GetURL(); 94 GURL active_url = entry->GetURL();
91 if (!active_url.SchemeIs("chrome-extension")) 95 if (!active_url.SchemeIs("chrome-extension"))
92 return; // Not a URL that we care about. 96 return; // Not a URL that we care about.
93 97
(...skipping 16 matching lines...) Expand all
110 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView( 114 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView(
111 BrowserView::GetBrowserViewForBrowser(browser) 115 BrowserView::GetBrowserViewForBrowser(browser)
112 ->toolbar() 116 ->toolbar()
113 ->app_menu_button(), 117 ->app_menu_button(),
114 views::BubbleBorder::TOP_RIGHT, std::move(ntp_overridden_bubble)); 118 views::BubbleBorder::TOP_RIGHT, std::move(ntp_overridden_bubble));
115 views::BubbleDelegateView::CreateBubble(bubble); 119 views::BubbleDelegateView::CreateBubble(bubble);
116 bubble->Show(); 120 bubble->Show();
117 } 121 }
118 122
119 } // namespace extensions 123 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698