Home | History | Annotate | Download | only in ui

Lines Matching refs:browser

5 #include "chrome/browser/ui/browser_navigator.h"
10 #include "chrome/browser/browser_url_handler.h"
11 #include "chrome/browser/extensions/extension_tab_helper.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/browser_window.h"
17 #include "chrome/browser/ui/omnibox/location_bar.h"
18 #include "chrome/browser/ui/status_bubble.h"
19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
20 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
23 #include "content/browser/site_instance.h"
24 #include "content/browser/tab_contents/tab_contents.h"
52 // Returns true if the specified Browser can open tabs. Not all Browsers support
54 // those types of Browser.
55 bool WindowCanOpenTabs(Browser* browser) {
56 return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) ||
57 browser->tabstrip_model()->empty();
60 // Finds an existing Browser compatible with |profile|, making a new one if no
61 // such Browser is located.
62 Browser* GetOrCreateBrowser(Profile* profile) {
63 Browser* browser = BrowserList::FindBrowserWithType(profile,
64 Browser::TYPE_NORMAL,
66 return browser ? browser : Browser::Create(profile);
82 // Returns the index of an existing singleton tab in |params->browser| matching
84 int GetIndexOfSingletonTab(browser::NavigateParams* params) {
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) {
129 void AdjustNavigateParamsForURL(browser::NavigateParams* params) {
135 params->browser ? params->browser->profile() : params->profile;
142 params->browser = Browser::GetOrCreateTabbedBrowser(profile);
143 params->window_action = browser::NavigateParams::SHOW_WINDOW;
148 // Returns a Browser that can host the navigation or tab addition specified in
149 // |params|. This might just return the same Browser specified in |params|, or
150 // some other if that Browser is deemed incompatible.
151 Browser* GetBrowserForDisposition(browser::NavigateParams* params) {
153 // target browser. This must happen first, before GetBrowserForDisposition()
154 // has a chance to replace |params->browser| with another one.
155 if (!params->source_contents && params->browser)
157 params->browser->GetSelectedTabContentsWrapper();
160 params->browser ? params->browser->profile() : params->profile;
164 if (!params->browser && profile) {
165 // We specified a profile instead of a browser; find or create one.
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
183 Browser::Type type = Browser::TYPE_POPUP;
184 if ((params->browser && (params->browser->type() & Browser::TYPE_APP)) ||
187 type = Browser::TYPE_APP_POPUP;
190 Browser* browser = new Browser(type, profile);
191 browser->set_override_bounds(params->window_bounds);
192 browser->InitBrowserWindow();
193 return browser;
198 // Make a new normal browser window.
200 Browser* browser = new Browser(Browser::TYPE_NORMAL, profile);
201 browser->InitBrowserWindow();
202 return browser;
223 void NormalizeDisposition(browser::NavigateParams* params) {
225 if (params->browser->tabstrip_model()->empty() &&
231 if (params->browser->profile()->IsOffTheRecord() &&
248 if (params->window_action == browser::NavigateParams::NO_ACTION)
249 params->window_action = browser::NavigateParams::SHOW_WINDOW;
262 // |source_browser| represents the Browser that was supplied in |params| before
264 Profile* GetSourceProfile(browser::NavigateParams* params,
265 Browser* source_browser) {
276 // the profile associated with the target browser.
277 return params->browser->profile();
281 // This class makes sure the Browser object held in |params| is made visible
285 explicit ScopedBrowserDisplayer(browser::NavigateParams* params)
289 if (params_->window_action == browser::NavigateParams::SHOW_WINDOW_INACTIVE)
290 params_->browser->window()->ShowInactive();
291 else if (params_->window_action == browser::NavigateParams::SHOW_WINDOW)
292 params_->browser->window()->Show();
295 browser::NavigateParams* params_;
308 explicit ScopedTargetContentsOwner(browser::NavigateParams* params)
328 browser::NavigateParams* params_;
335 namespace browser {
338 Browser* a_browser,
350 browser(a_browser),
354 NavigateParams::NavigateParams(Browser* a_browser,
364 browser(a_browser),
372 Browser* source_browser = params->browser;
375 params->browser = GetBrowserForDisposition(params);
376 if (!params->browser)
380 if (GetSourceProfile(params, source_browser) != params->browser->profile()) {
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.
417 GURL url = params->url.is_empty() ? params->browser->GetHomePage()
423 Browser::TabContentsFactory(
424 params->browser->profile(),
425 GetSiteInstance(source_contents, params->browser->profile(), url),
465 params->browser->UpdateUIForNavigationInTab(
475 // The navigation should insert a new tab into the target Browser.
476 params->browser->tabstrip_model()->AddTabContents(
482 // Browser's TabStripModel, we can release ownership.
487 TabContents* target = params->browser->GetTabContentsAt(singleton_index);
497 params->browser->ActivateTabAt(singleton_index, user_initiated);
501 } // namespace browser