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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 187443008: Elim Browser::AppType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add non trusted type test Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } else if (params->browser && !params->browser->app_name().empty()) { 157 } else if (params->browser && !params->browser->app_name().empty()) {
158 app_name = params->browser->app_name(); 158 app_name = params->browser->app_name();
159 } else if (params->source_contents) { 159 } else if (params->source_contents) {
160 extensions::TabHelper* extensions_tab_helper = 160 extensions::TabHelper* extensions_tab_helper =
161 extensions::TabHelper::FromWebContents(params->source_contents); 161 extensions::TabHelper::FromWebContents(params->source_contents);
162 if (extensions_tab_helper && extensions_tab_helper->is_app()) { 162 if (extensions_tab_helper && extensions_tab_helper->is_app()) {
163 app_name = web_app::GenerateApplicationNameFromExtensionId( 163 app_name = web_app::GenerateApplicationNameFromExtensionId(
164 extensions_tab_helper->extension_app()->id()); 164 extensions_tab_helper->extension_app()->id());
165 } 165 }
166 } 166 }
167 Browser::Type type = params->is_trusted ? Browser::TYPE_TRUSTED_POPUP
168 : Browser::TYPE_POPUP;
167 if (app_name.empty()) { 169 if (app_name.empty()) {
168 Browser::CreateParams browser_params( 170 Browser::CreateParams browser_params(
169 Browser::TYPE_POPUP, profile, params->host_desktop_type); 171 type, profile, params->host_desktop_type);
170 browser_params.initial_bounds = params->window_bounds; 172 browser_params.initial_bounds = params->window_bounds;
171 return new Browser(browser_params); 173 return new Browser(browser_params);
172 } 174 }
173 175
174 return new Browser(Browser::CreateParams::CreateForApp( 176 return new Browser(Browser::CreateParams::CreateForApp(
175 Browser::TYPE_POPUP, app_name, params->window_bounds, profile, 177 type, app_name, params->window_bounds, profile,
176 params->host_desktop_type)); 178 params->host_desktop_type));
177 } 179 }
178 case NEW_WINDOW: { 180 case NEW_WINDOW: {
179 // Make a new normal browser window. 181 // Make a new normal browser window.
180 return new Browser(Browser::CreateParams(profile, 182 return new Browser(Browser::CreateParams(profile,
181 params->host_desktop_type)); 183 params->host_desktop_type));
182 } 184 }
183 case OFF_THE_RECORD: 185 case OFF_THE_RECORD:
184 // Make or find an incognito window. 186 // Make or find an incognito window.
185 return GetOrCreateBrowser(profile->GetOffTheRecordProfile(), 187 return GetOrCreateBrowser(profile->GetOffTheRecordProfile(),
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 393
392 NavigateParams::NavigateParams(Browser* a_browser, 394 NavigateParams::NavigateParams(Browser* a_browser,
393 const GURL& a_url, 395 const GURL& a_url,
394 content::PageTransition a_transition) 396 content::PageTransition a_transition)
395 : url(a_url), 397 : url(a_url),
396 frame_tree_node_id(-1), 398 frame_tree_node_id(-1),
397 uses_post(false), 399 uses_post(false),
398 target_contents(NULL), 400 target_contents(NULL),
399 source_contents(NULL), 401 source_contents(NULL),
400 disposition(CURRENT_TAB), 402 disposition(CURRENT_TAB),
403 is_trusted(false),
401 transition(a_transition), 404 transition(a_transition),
402 is_renderer_initiated(false), 405 is_renderer_initiated(false),
403 tabstrip_index(-1), 406 tabstrip_index(-1),
404 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 407 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
405 window_action(NO_ACTION), 408 window_action(NO_ACTION),
406 user_gesture(true), 409 user_gesture(true),
407 path_behavior(RESPECT), 410 path_behavior(RESPECT),
408 ref_behavior(IGNORE_REF), 411 ref_behavior(IGNORE_REF),
409 browser(a_browser), 412 browser(a_browser),
410 initiating_profile(NULL), 413 initiating_profile(NULL),
411 host_desktop_type(GetHostDesktop(a_browser)), 414 host_desktop_type(GetHostDesktop(a_browser)),
412 should_replace_current_entry(false), 415 should_replace_current_entry(false),
413 should_set_opener(false) { 416 should_set_opener(false) {
414 } 417 }
415 418
416 NavigateParams::NavigateParams(Browser* a_browser, 419 NavigateParams::NavigateParams(Browser* a_browser,
417 WebContents* a_target_contents) 420 WebContents* a_target_contents)
418 : frame_tree_node_id(-1), 421 : frame_tree_node_id(-1),
419 uses_post(false), 422 uses_post(false),
420 target_contents(a_target_contents), 423 target_contents(a_target_contents),
421 source_contents(NULL), 424 source_contents(NULL),
422 disposition(CURRENT_TAB), 425 disposition(CURRENT_TAB),
426 is_trusted(false),
423 transition(content::PAGE_TRANSITION_LINK), 427 transition(content::PAGE_TRANSITION_LINK),
424 is_renderer_initiated(false), 428 is_renderer_initiated(false),
425 tabstrip_index(-1), 429 tabstrip_index(-1),
426 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 430 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
427 window_action(NO_ACTION), 431 window_action(NO_ACTION),
428 user_gesture(true), 432 user_gesture(true),
429 path_behavior(RESPECT), 433 path_behavior(RESPECT),
430 ref_behavior(IGNORE_REF), 434 ref_behavior(IGNORE_REF),
431 browser(a_browser), 435 browser(a_browser),
432 initiating_profile(NULL), 436 initiating_profile(NULL),
433 host_desktop_type(GetHostDesktop(a_browser)), 437 host_desktop_type(GetHostDesktop(a_browser)),
434 should_replace_current_entry(false), 438 should_replace_current_entry(false),
435 should_set_opener(false) { 439 should_set_opener(false) {
436 } 440 }
437 441
438 NavigateParams::NavigateParams(Profile* a_profile, 442 NavigateParams::NavigateParams(Profile* a_profile,
439 const GURL& a_url, 443 const GURL& a_url,
440 content::PageTransition a_transition) 444 content::PageTransition a_transition)
441 : url(a_url), 445 : url(a_url),
442 frame_tree_node_id(-1), 446 frame_tree_node_id(-1),
443 uses_post(false), 447 uses_post(false),
444 target_contents(NULL), 448 target_contents(NULL),
445 source_contents(NULL), 449 source_contents(NULL),
446 disposition(NEW_FOREGROUND_TAB), 450 disposition(NEW_FOREGROUND_TAB),
451 is_trusted(false),
447 transition(a_transition), 452 transition(a_transition),
448 is_renderer_initiated(false), 453 is_renderer_initiated(false),
449 tabstrip_index(-1), 454 tabstrip_index(-1),
450 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 455 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
451 window_action(SHOW_WINDOW), 456 window_action(SHOW_WINDOW),
452 user_gesture(true), 457 user_gesture(true),
453 path_behavior(RESPECT), 458 path_behavior(RESPECT),
454 ref_behavior(IGNORE_REF), 459 ref_behavior(IGNORE_REF),
455 browser(NULL), 460 browser(NULL),
456 initiating_profile(a_profile), 461 initiating_profile(a_profile),
457 host_desktop_type(chrome::GetActiveDesktop()), 462 host_desktop_type(chrome::GetActiveDesktop()),
458 should_replace_current_entry(false), 463 should_replace_current_entry(false),
459 should_set_opener(false) { 464 should_set_opener(false) {
460 } 465 }
461 466
462 NavigateParams::~NavigateParams() {} 467 NavigateParams::~NavigateParams() {}
463 468
464 void FillNavigateParamsFromOpenURLParams(chrome::NavigateParams* nav_params, 469 void FillNavigateParamsFromOpenURLParams(chrome::NavigateParams* nav_params,
465 const content::OpenURLParams& params) { 470 const content::OpenURLParams& params) {
466 nav_params->referrer = params.referrer; 471 nav_params->referrer = params.referrer;
467 nav_params->frame_tree_node_id = params.frame_tree_node_id; 472 nav_params->frame_tree_node_id = params.frame_tree_node_id;
468 nav_params->redirect_chain = params.redirect_chain; 473 nav_params->redirect_chain = params.redirect_chain;
469 nav_params->extra_headers = params.extra_headers; 474 nav_params->extra_headers = params.extra_headers;
470 nav_params->disposition = params.disposition; 475 nav_params->disposition = params.disposition;
476 nav_params->is_trusted = false;
471 nav_params->is_renderer_initiated = params.is_renderer_initiated; 477 nav_params->is_renderer_initiated = params.is_renderer_initiated;
472 nav_params->transferred_global_request_id = 478 nav_params->transferred_global_request_id =
473 params.transferred_global_request_id; 479 params.transferred_global_request_id;
474 nav_params->should_replace_current_entry = 480 nav_params->should_replace_current_entry =
475 params.should_replace_current_entry; 481 params.should_replace_current_entry;
476 nav_params->uses_post = params.uses_post; 482 nav_params->uses_post = params.uses_post;
477 nav_params->browser_initiated_post_data = params.browser_initiated_post_data; 483 nav_params->browser_initiated_post_data = params.browser_initiated_post_data;
478 } 484 }
479 485
480 void Navigate(NavigateParams* params) { 486 void Navigate(NavigateParams* params) {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 bool reverse_on_redirect = false; 761 bool reverse_on_redirect = false;
756 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 762 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
757 &rewritten_url, browser_context, &reverse_on_redirect); 763 &rewritten_url, browser_context, &reverse_on_redirect);
758 764
759 // Some URLs are mapped to uber subpages. Do not allow them in incognito. 765 // Some URLs are mapped to uber subpages. Do not allow them in incognito.
760 return !(rewritten_url.scheme() == content::kChromeUIScheme && 766 return !(rewritten_url.scheme() == content::kChromeUIScheme &&
761 rewritten_url.host() == chrome::kChromeUIUberHost); 767 rewritten_url.host() == chrome::kChromeUIUberHost);
762 } 768 }
763 769
764 } // namespace chrome 770 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator.h ('k') | chrome/browser/ui/browser_navigator_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698