OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 253 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
254 switches::kEnableFastUnload); | 254 switches::kEnableFastUnload); |
255 } | 255 } |
256 | 256 |
257 } // namespace | 257 } // namespace |
258 | 258 |
259 //////////////////////////////////////////////////////////////////////////////// | 259 //////////////////////////////////////////////////////////////////////////////// |
260 // Browser, CreateParams: | 260 // Browser, CreateParams: |
261 | 261 |
262 Browser::CreateParams::CreateParams(Profile* profile, | 262 Browser::CreateParams::CreateParams(Profile* profile, |
263 chrome::HostDesktopType host_desktop_type) | 263 ui::HostDesktopType host_desktop_type) |
264 : type(TYPE_TABBED), | 264 : type(TYPE_TABBED), |
265 profile(profile), | 265 profile(profile), |
266 host_desktop_type(host_desktop_type), | 266 host_desktop_type(host_desktop_type), |
267 trusted_source(false), | 267 trusted_source(false), |
268 initial_show_state(ui::SHOW_STATE_DEFAULT), | 268 initial_show_state(ui::SHOW_STATE_DEFAULT), |
269 is_session_restore(false), | 269 is_session_restore(false), |
270 window(NULL) { | 270 window(NULL) {} |
271 } | |
272 | 271 |
273 Browser::CreateParams::CreateParams(Type type, | 272 Browser::CreateParams::CreateParams(Type type, |
274 Profile* profile, | 273 Profile* profile, |
275 chrome::HostDesktopType host_desktop_type) | 274 ui::HostDesktopType host_desktop_type) |
276 : type(type), | 275 : type(type), |
277 profile(profile), | 276 profile(profile), |
278 host_desktop_type(host_desktop_type), | 277 host_desktop_type(host_desktop_type), |
279 trusted_source(false), | 278 trusted_source(false), |
280 initial_show_state(ui::SHOW_STATE_DEFAULT), | 279 initial_show_state(ui::SHOW_STATE_DEFAULT), |
281 is_session_restore(false), | 280 is_session_restore(false), |
282 window(NULL) { | 281 window(NULL) {} |
283 } | |
284 | 282 |
285 // static | 283 // static |
286 Browser::CreateParams Browser::CreateParams::CreateForApp( | 284 Browser::CreateParams Browser::CreateParams::CreateForApp( |
287 const std::string& app_name, | 285 const std::string& app_name, |
288 bool trusted_source, | 286 bool trusted_source, |
289 const gfx::Rect& window_bounds, | 287 const gfx::Rect& window_bounds, |
290 Profile* profile, | 288 Profile* profile, |
291 chrome::HostDesktopType host_desktop_type) { | 289 ui::HostDesktopType host_desktop_type) { |
292 DCHECK(!app_name.empty()); | 290 DCHECK(!app_name.empty()); |
293 | 291 |
294 CreateParams params(TYPE_POPUP, profile, host_desktop_type); | 292 CreateParams params(TYPE_POPUP, profile, host_desktop_type); |
295 params.app_name = app_name; | 293 params.app_name = app_name; |
296 params.trusted_source = trusted_source; | 294 params.trusted_source = trusted_source; |
297 params.initial_bounds = window_bounds; | 295 params.initial_bounds = window_bounds; |
298 | 296 |
299 return params; | 297 return params; |
300 } | 298 } |
301 | 299 |
302 // static | 300 // static |
303 Browser::CreateParams Browser::CreateParams::CreateForDevTools( | 301 Browser::CreateParams Browser::CreateParams::CreateForDevTools( |
304 Profile* profile, | 302 Profile* profile, |
305 chrome::HostDesktopType host_desktop_type) { | 303 ui::HostDesktopType host_desktop_type) { |
306 CreateParams params(TYPE_POPUP, profile, host_desktop_type); | 304 CreateParams params(TYPE_POPUP, profile, host_desktop_type); |
307 params.app_name = DevToolsWindow::kDevToolsApp; | 305 params.app_name = DevToolsWindow::kDevToolsApp; |
308 params.trusted_source = true; | 306 params.trusted_source = true; |
309 return params; | 307 return params; |
310 } | 308 } |
311 | 309 |
312 //////////////////////////////////////////////////////////////////////////////// | 310 //////////////////////////////////////////////////////////////////////////////// |
313 // Browser, InterstitialObserver: | 311 // Browser, InterstitialObserver: |
314 | 312 |
315 class Browser::InterstitialObserver : public content::WebContentsObserver { | 313 class Browser::InterstitialObserver : public content::WebContentsObserver { |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 title = CoreTabHelper::GetDefaultTitle(); | 610 title = CoreTabHelper::GetDefaultTitle(); |
613 | 611 |
614 #if defined(OS_MACOSX) | 612 #if defined(OS_MACOSX) |
615 // On Mac, we don't want to suffix the page title with | 613 // On Mac, we don't want to suffix the page title with |
616 // the application name. | 614 // the application name. |
617 return title; | 615 return title; |
618 #elif defined(USE_ASH) | 616 #elif defined(USE_ASH) |
619 // On Ash, we don't want to suffix the page title with the application name, | 617 // On Ash, we don't want to suffix the page title with the application name, |
620 // but on Windows, where USE_ASH can also be true, we still want the prefix | 618 // but on Windows, where USE_ASH can also be true, we still want the prefix |
621 // on desktop. | 619 // on desktop. |
622 if (host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 620 if (host_desktop_type() == ui::HOST_DESKTOP_TYPE_ASH) |
623 return title; | 621 return title; |
624 #endif | 622 #endif |
625 // Don't append the app name to window titles on app frames and app popups | 623 // Don't append the app name to window titles on app frames and app popups |
626 return is_app() ? | 624 return is_app() ? |
627 title : | 625 title : |
628 l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); | 626 l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); |
629 } | 627 } |
630 | 628 |
631 // static | 629 // static |
632 void Browser::FormatTitleForDisplay(base::string16* title) { | 630 void Browser::FormatTitleForDisplay(base::string16* title) { |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 if (contents && !allow_js_access) { | 2667 if (contents && !allow_js_access) { |
2670 contents->web_contents()->GetController().LoadURL( | 2668 contents->web_contents()->GetController().LoadURL( |
2671 target_url, | 2669 target_url, |
2672 content::Referrer(), | 2670 content::Referrer(), |
2673 ui::PAGE_TRANSITION_LINK, | 2671 ui::PAGE_TRANSITION_LINK, |
2674 std::string()); // No extra headers. | 2672 std::string()); // No extra headers. |
2675 } | 2673 } |
2676 | 2674 |
2677 return contents != NULL; | 2675 return contents != NULL; |
2678 } | 2676 } |
OLD | NEW |