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

Side by Side Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app_list/start_page_service.h" 5 #include "chrome/browser/ui/app_list/start_page_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 void AddNewContents(content::WebContents* source, 176 void AddNewContents(content::WebContents* source,
177 content::WebContents* new_contents, 177 content::WebContents* new_contents,
178 WindowOpenDisposition disposition, 178 WindowOpenDisposition disposition,
179 const gfx::Rect& initial_pos, 179 const gfx::Rect& initial_pos,
180 bool user_gesture, 180 bool user_gesture,
181 bool* was_blocked) override { 181 bool* was_blocked) override {
182 chrome::ScopedTabbedBrowserDisplayer displayer(profile_); 182 chrome::ScopedTabbedBrowserDisplayer displayer(profile_);
183 // Force all links to open in a new tab, even if they were trying to open a 183 // Force all links to open in a new tab, even if they were trying to open a
184 // new window. 184 // new window.
185 disposition = 185 disposition = disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB
186 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; 186 ? disposition
187 chrome::AddWebContents(displayer.browser(), 187 : WindowOpenDisposition::NEW_FOREGROUND_TAB;
188 nullptr, 188 chrome::AddWebContents(displayer.browser(), nullptr, new_contents,
189 new_contents, 189 disposition, initial_pos, user_gesture, was_blocked);
190 disposition,
191 initial_pos,
192 user_gesture,
193 was_blocked);
194 } 190 }
195 191
196 content::WebContents* OpenURLFromTab( 192 content::WebContents* OpenURLFromTab(
197 content::WebContents* source, 193 content::WebContents* source,
198 const content::OpenURLParams& params) override { 194 const content::OpenURLParams& params) override {
199 // Force all links to open in a new tab, even if they were trying to open a 195 // Force all links to open in a new tab, even if they were trying to open a
200 // window. 196 // window.
201 chrome::NavigateParams new_tab_params( 197 chrome::NavigateParams new_tab_params(
202 static_cast<Browser*>(nullptr), params.url, params.transition); 198 static_cast<Browser*>(nullptr), params.url, params.transition);
203 if (params.disposition == NEW_BACKGROUND_TAB) { 199 if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) {
204 new_tab_params.disposition = NEW_BACKGROUND_TAB; 200 new_tab_params.disposition = WindowOpenDisposition::NEW_BACKGROUND_TAB;
205 } else { 201 } else {
206 new_tab_params.disposition = NEW_FOREGROUND_TAB; 202 new_tab_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
207 new_tab_params.window_action = chrome::NavigateParams::SHOW_WINDOW; 203 new_tab_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
208 } 204 }
209 205
210 new_tab_params.initiating_profile = profile_; 206 new_tab_params.initiating_profile = profile_;
211 chrome::Navigate(&new_tab_params); 207 chrome::Navigate(&new_tab_params);
212 208
213 return new_tab_params.target_contents; 209 return new_tab_params.target_contents;
214 } 210 }
215 211
216 bool PreHandleGestureEvent(content::WebContents* /*source*/, 212 bool PreHandleGestureEvent(content::WebContents* /*source*/,
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 694
699 // Check for a new doodle. 695 // Check for a new doodle.
700 content::BrowserThread::PostDelayedTask( 696 content::BrowserThread::PostDelayedTask(
701 content::BrowserThread::UI, FROM_HERE, 697 content::BrowserThread::UI, FROM_HERE,
702 base::Bind(&StartPageService::FetchDoodleJson, 698 base::Bind(&StartPageService::FetchDoodleJson,
703 weak_factory_.GetWeakPtr()), 699 weak_factory_.GetWeakPtr()),
704 recheck_delay); 700 recheck_delay);
705 } 701 }
706 702
707 } // namespace app_list 703 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.cc ('k') | chrome/browser/ui/apps/chrome_app_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698