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

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

Issue 1786933002: Revert of [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"
15 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h" 15 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
18 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 17 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
19 #include "chrome/browser/ui/views/toolbar/home_button.h" 18 #include "chrome/browser/ui/views/toolbar/home_button.h"
20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
21 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h" 20 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h"
22 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
23 #include "content/public/browser/browser_url_handler.h" 22 #include "content/public/browser/browser_url_handler.h"
24 #include "content/public/browser/navigation_entry.h" 23 #include "content/public/browser/navigation_entry.h"
(...skipping 15 matching lines...) Expand all
40 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView( 39 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView(
41 anchor_view, arrow, std::move(settings_api_bubble)); 40 anchor_view, arrow, std::move(settings_api_bubble));
42 views::BubbleDelegateView::CreateBubble(bubble); 41 views::BubbleDelegateView::CreateBubble(bubble);
43 bubble->Show(); 42 bubble->Show();
44 } 43 }
45 44
46 } // namespace 45 } // namespace
47 46
48 void MaybeShowExtensionControlledHomeNotification(Browser* browser) { 47 void MaybeShowExtensionControlledHomeNotification(Browser* browser) {
49 #if !defined(OS_WIN) 48 #if !defined(OS_WIN)
50 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing()) 49 return;
51 return;
52 #endif 50 #endif
53 51
54 // The bubble will try to anchor itself against the home button 52 // The bubble will try to anchor itself against the home button
55 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)-> 53 views::View* anchor_view = BrowserView::GetBrowserViewForBrowser(browser)->
56 toolbar()->home_button(); 54 toolbar()->home_button();
57 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE, 55 ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE,
58 browser, 56 browser,
59 anchor_view, 57 anchor_view,
60 views::BubbleBorder::TOP_LEFT); 58 views::BubbleBorder::TOP_LEFT);
61 } 59 }
62 60
63 void MaybeShowExtensionControlledSearchNotification( 61 void MaybeShowExtensionControlledSearchNotification(
64 Profile* profile, 62 Profile* profile,
65 content::WebContents* web_contents, 63 content::WebContents* web_contents,
66 AutocompleteMatch::Type match_type) { 64 AutocompleteMatch::Type match_type) {
67 #if !defined(OS_WIN) 65 #if !defined(OS_WIN)
68 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing()) 66 return;
69 return;
70 #endif 67 #endif
71 68
72 if (AutocompleteMatch::IsSearchType(match_type) && 69 if (AutocompleteMatch::IsSearchType(match_type) &&
73 match_type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) { 70 match_type != AutocompleteMatchType::SEARCH_OTHER_ENGINE) {
74 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 71 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
75 ToolbarView* toolbar = 72 ToolbarView* toolbar =
76 BrowserView::GetBrowserViewForBrowser(browser)->toolbar(); 73 BrowserView::GetBrowserViewForBrowser(browser)->toolbar();
77 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, browser, 74 ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, browser,
78 toolbar->app_menu_button(), 75 toolbar->app_menu_button(),
79 views::BubbleBorder::TOP_RIGHT); 76 views::BubbleBorder::TOP_RIGHT);
80 } 77 }
81 } 78 }
82 79
83 void MaybeShowExtensionControlledNewTabPage( 80 void MaybeShowExtensionControlledNewTabPage(
84 Browser* browser, content::WebContents* web_contents) { 81 Browser* browser, content::WebContents* web_contents) {
85 #if !defined(OS_WIN) 82 #if !defined(OS_WIN)
86 if (!ExtensionMessageBubbleFactory::is_enabled_for_testing()) 83 return;
87 return;
88 #endif 84 #endif
89 85
90 content::NavigationEntry* entry = 86 content::NavigationEntry* entry =
91 web_contents->GetController().GetActiveEntry(); 87 web_contents->GetController().GetActiveEntry();
92 if (!entry) 88 if (!entry)
93 return; 89 return;
94 GURL active_url = entry->GetURL(); 90 GURL active_url = entry->GetURL();
95 if (!active_url.SchemeIs("chrome-extension")) 91 if (!active_url.SchemeIs("chrome-extension"))
96 return; // Not a URL that we care about. 92 return; // Not a URL that we care about.
97 93
(...skipping 16 matching lines...) Expand all
114 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView( 110 ExtensionMessageBubbleView* bubble = new ExtensionMessageBubbleView(
115 BrowserView::GetBrowserViewForBrowser(browser) 111 BrowserView::GetBrowserViewForBrowser(browser)
116 ->toolbar() 112 ->toolbar()
117 ->app_menu_button(), 113 ->app_menu_button(),
118 views::BubbleBorder::TOP_RIGHT, std::move(ntp_overridden_bubble)); 114 views::BubbleBorder::TOP_RIGHT, std::move(ntp_overridden_bubble));
119 views::BubbleDelegateView::CreateBubble(bubble); 115 views::BubbleDelegateView::CreateBubble(bubble);
120 bubble->Show(); 116 bubble->Show();
121 } 117 }
122 118
123 } // namespace extensions 119 } // 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