Home | History | Annotate | Download | only in ui

Lines Matching refs:params

82 // Returns the index of an existing singleton tab in |params->browser| matching
83 // the URL specified in |params|.
84 int GetIndexOfSingletonTab(browser::NavigateParams* params) {
85 if (params->disposition != SINGLETON_TAB)
91 GURL rewritten_url(params->url);
94 params->browser->profile(),
98 int start_index = std::max(0, params->browser->active_index());
99 int tab_count = params->browser->tab_count();
103 params->browser->GetTabContentsWrapperAt(tab_index);
107 if (params->path_behavior == browser::NavigateParams::IGNORE_AND_NAVIGATE ||
108 params->path_behavior == browser::NavigateParams::IGNORE_AND_STAY_PUT) {
114 params->url, replacements) ||
117 params->target_contents = tab;
129 void AdjustNavigateParamsForURL(browser::NavigateParams* params) {
130 if (!params->target_contents &&
131 params->url.scheme() == chrome::kChromeUIScheme &&
132 (params->url.host() == chrome::kChromeUISettingsHost ||
133 params->url.host() == chrome::kChromeUIBookmarksHost)) {
135 params->browser ? params->browser->profile() : params->profile;
140 params->disposition = SINGLETON_TAB;
141 params->profile = profile;
142 params->browser = Browser::GetOrCreateTabbedBrowser(profile);
143 params->window_action = browser::NavigateParams::SHOW_WINDOW;
149 // |params|. This might just return the same Browser specified in |params|, or
151 Browser* GetBrowserForDisposition(browser::NavigateParams* params) {
154 // has a chance to replace |params->browser| with another one.
155 if (!params->source_contents && params->browser)
156 params->source_contents =
157 params->browser->GetSelectedTabContentsWrapper();
160 params->browser ? params->browser->profile() : params->profile;
162 switch (params->disposition) {
164 if (!params->browser && profile) {
166 params->browser = Browser::GetOrCreateTabbedBrowser(profile);
168 return params->browser;
173 if (params->browser && WindowCanOpenTabs(params->browser))
174 return params->browser;
181 // Make a new popup window. Coerce app-style if |params->browser| or the
184 if ((params->browser && (params->browser->type() & Browser::TYPE_APP)) ||
185 (params->source_contents &&
186 params->source_contents->extension_tab_helper()->is_app())) {
191 browser->set_override_bounds(params->window_bounds);
223 void NormalizeDisposition(browser::NavigateParams* params) {
225 if (params->browser->tabstrip_model()->empty() &&
226 (params->disposition == NEW_BACKGROUND_TAB ||
227 params->disposition == CURRENT_TAB ||
228 params->disposition == SINGLETON_TAB)) {
229 params->disposition = NEW_FOREGROUND_TAB;
231 if (params->browser->profile()->IsOffTheRecord() &&
232 params->disposition == OFF_THE_RECORD) {
233 params->disposition = NEW_FOREGROUND_TAB;
236 switch (params->disposition) {
241 params->tabstrip_add_types &= ~TabStripModel::ADD_ACTIVE;
248 if (params->window_action == browser::NavigateParams::NO_ACTION)
249 params->window_action = browser::NavigateParams::SHOW_WINDOW;
253 params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE;
262 // |source_browser| represents the Browser that was supplied in |params| before
264 Profile* GetSourceProfile(browser::NavigateParams* params,
266 if (params->source_contents)
267 return params->source_contents->profile();
272 if (params->profile)
273 return params->profile;
277 return params->browser->profile();
281 // This class makes sure the Browser object held in |params| is made visible
282 // by the time it goes out of scope, provided |params| wants it to be shown.
285 explicit ScopedBrowserDisplayer(browser::NavigateParams* params)
286 : params_(params) {
305 // params->target_contents field is set to NULL.
308 explicit ScopedTargetContentsOwner(browser::NavigateParams* params)
309 : params_(params) {
371 void Navigate(NavigateParams* params) {
372 Browser* source_browser = params->browser;
373 AdjustNavigateParamsForURL(params);
375 params->browser = GetBrowserForDisposition(params);
376 if (!params->browser)
380 if (GetSourceProfile(params, source_browser) != params->browser->profile()) {
383 params->source_contents = NULL;
384 params->referrer = GURL();
387 if (params->window_action == browser::NavigateParams::NO_ACTION &&
388 source_browser != params->browser &&
389 params->browser->tabstrip_model()->empty()) {
391 params->window_action = browser::NavigateParams::SHOW_WINDOW;
394 // Make sure the Browser is shown if params call for it.
395 ScopedBrowserDisplayer displayer(params);
399 ScopedTargetContentsOwner target_contents_owner(params);
402 NormalizeDisposition(params);
407 PageTransition::StripQualifier(params->transition);
412 int singleton_index = GetIndexOfSingletonTab(params);
416 if (!params->target_contents && singleton_index < 0) {
417 GURL url = params->url.is_empty() ? params->browser->GetHomePage()
418 : params->url;
419 if (params->disposition != CURRENT_TAB) {
420 TabContents* source_contents = params->source_contents ?
421 params->source_contents->tab_contents() : NULL;
422 params->target_contents =
424 params->browser->profile(),
425 GetSiteInstance(source_contents, params->browser->profile(), url),
429 // This function takes ownership of |params->target_contents| until it
432 params->target_contents->extension_tab_helper()->
433 SetExtensionAppById(params
438 if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) {
440 params->target_contents->tab_contents()->WasHidden();
445 params->target_contents = params->source_contents;
446 DCHECK(params->target_contents);
450 static_cast<RenderViewHostDelegate*>(params->target_contents->
455 params->target_contents->controller().LoadURL(url, params->referrer,
456 params->transition);
463 if (params->source_contents == params->target_contents) {
465 params->browser->UpdateUIForNavigationInTab(
466 params->target_contents,
467 params->transition,
472 if (params->tabstrip_index != -1)
473 params->tabstrip_add_types |= TabStripModel::ADD_FORCE_INDEX;
476 params->browser->tabstrip_model()->AddTabContents(
477 params->target_contents,
478 params->tabstrip_index,
479 params->transition,
480 params->tabstrip_add_types);
481 // Now that the |params->target_contents| is safely owned by the target
487 TabContents* target = params->browser->GetTabContentsAt(singleton_index);
489 if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE &&
490 target->GetURL() != params->url) {
492 params->url, params->referrer, params->transition);
496 if (params->source_contents != params->target_contents)
497 params->browser->ActivateTabAt(singleton_index, user_initiated);