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

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

Issue 8253002: Move PageTransition into content namespace. While I'm touching all these files, I've also updated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 std::string* extra_headers) { 295 std::string* extra_headers) {
296 #if defined(OS_WIN) 296 #if defined(OS_WIN)
297 #if defined(GOOGLE_CHROME_BUILD) 297 #if defined(GOOGLE_CHROME_BUILD)
298 if (!profile) 298 if (!profile)
299 profile = params->profile; 299 profile = params->profile;
300 300
301 // If this is a home page navigation, check to see if the home page is 301 // If this is a home page navigation, check to see if the home page is
302 // set to Google and add RLZ HTTP headers to the request. This is only 302 // set to Google and add RLZ HTTP headers to the request. This is only
303 // done if Google was the original home page, and not changed afterwards by 303 // done if Google was the original home page, and not changed afterwards by
304 // the user. 304 // the user.
305 if (profile && (params->transition & PageTransition::HOME_PAGE) != 0) { 305 if (profile &&
306 (params->transition & content::PAGE_TRANSITION_HOME_PAGE) != 0) {
306 PrefService* pref_service = profile->GetPrefs(); 307 PrefService* pref_service = profile->GetPrefs();
307 if (pref_service) { 308 if (pref_service) {
308 if (!pref_service->GetBoolean(prefs::kHomePageChanged)) { 309 if (!pref_service->GetBoolean(prefs::kHomePageChanged)) {
309 std::string homepage = pref_service->GetString(prefs::kHomePage); 310 std::string homepage = pref_service->GetString(prefs::kHomePage);
310 if (homepage == GoogleURLTracker::kDefaultGoogleHomepage) { 311 if (homepage == GoogleURLTracker::kDefaultGoogleHomepage) {
311 std::wstring rlz_string; 312 std::wstring rlz_string;
312 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz_string); 313 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz_string);
313 if (!rlz_string.empty()) { 314 if (!rlz_string.empty()) {
314 net::HttpUtil::AppendHeaderIfMissing("X-Rlz-String", 315 net::HttpUtil::AppendHeaderIfMissing("X-Rlz-String",
315 WideToUTF8(rlz_string), 316 WideToUTF8(rlz_string),
316 extra_headers); 317 extra_headers);
317 } 318 }
318 } 319 }
319 } 320 }
320 } 321 }
321 } 322 }
322 #endif 323 #endif
323 #endif 324 #endif
324 } 325 }
325 326
326 } // namespace 327 } // namespace
327 328
328 namespace browser { 329 namespace browser {
329 330
330 NavigateParams::NavigateParams( 331 NavigateParams::NavigateParams(
331 Browser* a_browser, 332 Browser* a_browser,
332 const GURL& a_url, 333 const GURL& a_url,
333 PageTransition::Type a_transition) 334 content::PageTransition a_transition)
334 : url(a_url), 335 : url(a_url),
335 target_contents(NULL), 336 target_contents(NULL),
336 source_contents(NULL), 337 source_contents(NULL),
337 disposition(CURRENT_TAB), 338 disposition(CURRENT_TAB),
338 transition(a_transition), 339 transition(a_transition),
339 tabstrip_index(-1), 340 tabstrip_index(-1),
340 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 341 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
341 window_action(NO_ACTION), 342 window_action(NO_ACTION),
342 user_gesture(true), 343 user_gesture(true),
343 path_behavior(RESPECT), 344 path_behavior(RESPECT),
344 ref_behavior(IGNORE_REF), 345 ref_behavior(IGNORE_REF),
345 browser(a_browser), 346 browser(a_browser),
346 profile(NULL) { 347 profile(NULL) {
347 } 348 }
348 349
349 NavigateParams::NavigateParams(Browser* a_browser, 350 NavigateParams::NavigateParams(Browser* a_browser,
350 TabContentsWrapper* a_target_contents) 351 TabContentsWrapper* a_target_contents)
351 : target_contents(a_target_contents), 352 : target_contents(a_target_contents),
352 source_contents(NULL), 353 source_contents(NULL),
353 disposition(CURRENT_TAB), 354 disposition(CURRENT_TAB),
354 transition(PageTransition::LINK), 355 transition(content::PAGE_TRANSITION_LINK),
355 tabstrip_index(-1), 356 tabstrip_index(-1),
356 tabstrip_add_types(TabStripModel::ADD_ACTIVE), 357 tabstrip_add_types(TabStripModel::ADD_ACTIVE),
357 window_action(NO_ACTION), 358 window_action(NO_ACTION),
358 user_gesture(true), 359 user_gesture(true),
359 path_behavior(RESPECT), 360 path_behavior(RESPECT),
360 ref_behavior(IGNORE_REF), 361 ref_behavior(IGNORE_REF),
361 browser(a_browser), 362 browser(a_browser),
362 profile(NULL) { 363 profile(NULL) {
363 } 364 }
364 365
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 418
418 // If we create a popup window from a non user-gesture, don't activate it. 419 // If we create a popup window from a non user-gesture, don't activate it.
419 if (params->window_action == browser::NavigateParams::SHOW_WINDOW && 420 if (params->window_action == browser::NavigateParams::SHOW_WINDOW &&
420 params->disposition == NEW_POPUP && 421 params->disposition == NEW_POPUP &&
421 params->user_gesture == false) { 422 params->user_gesture == false) {
422 params->window_action = browser::NavigateParams::SHOW_WINDOW_INACTIVE; 423 params->window_action = browser::NavigateParams::SHOW_WINDOW_INACTIVE;
423 } 424 }
424 425
425 // Determine if the navigation was user initiated. If it was, we need to 426 // Determine if the navigation was user initiated. If it was, we need to
426 // inform the target TabContents, and we may need to update the UI. 427 // inform the target TabContents, and we may need to update the UI.
427 PageTransition::Type base_transition = 428 content::PageTransition base_transition =
428 PageTransition::StripQualifier(params->transition); 429 content::PageTransitionStripQualifier(params->transition);
429 bool user_initiated = params->transition & PageTransition::FROM_ADDRESS_BAR || 430 bool user_initiated =
430 base_transition == PageTransition::TYPED || 431 params->transition & content::PAGE_TRANSITION_FROM_ADDRESS_BAR ||
431 base_transition == PageTransition::AUTO_BOOKMARK || 432 base_transition == content::PAGE_TRANSITION_TYPED ||
432 base_transition == PageTransition::GENERATED || 433 base_transition == content::PAGE_TRANSITION_AUTO_BOOKMARK ||
433 base_transition == PageTransition::START_PAGE || 434 base_transition == content::PAGE_TRANSITION_GENERATED ||
434 base_transition == PageTransition::RELOAD || 435 base_transition == content::PAGE_TRANSITION_START_PAGE ||
435 base_transition == PageTransition::KEYWORD; 436 base_transition == content::PAGE_TRANSITION_RELOAD ||
437 base_transition == content::PAGE_TRANSITION_KEYWORD;
436 438
437 std::string extra_headers; 439 std::string extra_headers;
438 440
439 // Check if this is a singleton tab that already exists 441 // Check if this is a singleton tab that already exists
440 int singleton_index = GetIndexOfSingletonTab(params); 442 int singleton_index = GetIndexOfSingletonTab(params);
441 443
442 // If no target TabContents was specified, we need to construct one if we are 444 // If no target TabContents was specified, we need to construct one if we are
443 // supposed to target a new tab; unless it's a singleton that already exists. 445 // supposed to target a new tab; unless it's a singleton that already exists.
444 if (!params->target_contents && singleton_index < 0) { 446 if (!params->target_contents && singleton_index < 0) {
445 GURL url; 447 GURL url;
446 if (params->url.is_empty()) { 448 if (params->url.is_empty()) {
447 url = params->browser->GetHomePage(); 449 url = params->browser->GetHomePage();
448 params->transition |= PageTransition::HOME_PAGE; 450 params->transition = content::PageTransitionFromInt(
451 params->transition | content::PAGE_TRANSITION_HOME_PAGE);
Jói 2011/10/12 22:35:02 indent 2 more
449 } else { 452 } else {
450 url = params->url; 453 url = params->url;
451 } 454 }
452 455
453 if (params->disposition != CURRENT_TAB) { 456 if (params->disposition != CURRENT_TAB) {
454 TabContents* source_contents = params->source_contents ? 457 TabContents* source_contents = params->source_contents ?
455 params->source_contents->tab_contents() : NULL; 458 params->source_contents->tab_contents() : NULL;
456 params->target_contents = 459 params->target_contents =
457 Browser::TabContentsFactory( 460 Browser::TabContentsFactory(
458 params->browser->profile(), 461 params->browser->profile(),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 rewritten_url, replacements)) { 601 rewritten_url, replacements)) {
599 params->target_contents = tab; 602 params->target_contents = tab;
600 return tab_index; 603 return tab_index;
601 } 604 }
602 } 605 }
603 606
604 return -1; 607 return -1;
605 } 608 }
606 609
607 } // namespace browser 610 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698