OLD | NEW |
---|---|
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.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 // OS_WIN | 10 #endif // OS_WIN |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 #include "content/public/common/page_zoom.h" | 176 #include "content/public/common/page_zoom.h" |
177 #include "content/public/common/renderer_preferences.h" | 177 #include "content/public/common/renderer_preferences.h" |
178 #include "grit/chromium_strings.h" | 178 #include "grit/chromium_strings.h" |
179 #include "grit/generated_resources.h" | 179 #include "grit/generated_resources.h" |
180 #include "grit/locale_settings.h" | 180 #include "grit/locale_settings.h" |
181 #include "grit/theme_resources_standard.h" | 181 #include "grit/theme_resources_standard.h" |
182 #include "net/base/net_util.h" | 182 #include "net/base/net_util.h" |
183 #include "net/base/registry_controlled_domain.h" | 183 #include "net/base/registry_controlled_domain.h" |
184 #include "net/cookies/cookie_monster.h" | 184 #include "net/cookies/cookie_monster.h" |
185 #include "net/url_request/url_request_context.h" | 185 #include "net/url_request/url_request_context.h" |
186 #include "ui/aura/window.h" | |
sky
2012/05/21 16:42:50
You shouldn't need this.
Mr4D (OOO till 08-26)
2012/05/21 17:15:43
Done.
| |
186 #include "ui/base/animation/animation.h" | 187 #include "ui/base/animation/animation.h" |
187 #include "ui/base/l10n/l10n_util.h" | 188 #include "ui/base/l10n/l10n_util.h" |
188 #include "ui/gfx/point.h" | 189 #include "ui/gfx/point.h" |
189 #include "webkit/glue/web_intent_data.h" | 190 #include "webkit/glue/web_intent_data.h" |
190 #include "webkit/glue/webkit_glue.h" | 191 #include "webkit/glue/webkit_glue.h" |
191 #include "webkit/glue/window_open_disposition.h" | 192 #include "webkit/glue/window_open_disposition.h" |
192 #include "webkit/plugins/webplugininfo.h" | 193 #include "webkit/plugins/webplugininfo.h" |
193 | 194 |
194 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
195 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" | 196 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2689 GetStatusBubble()->Hide(); | 2690 GetStatusBubble()->Hide(); |
2690 | 2691 |
2691 // Update the location bar. This is synchronous. We specifically don't | 2692 // Update the location bar. This is synchronous. We specifically don't |
2692 // update the load state since the load hasn't started yet and updating it | 2693 // update the load state since the load hasn't started yet and updating it |
2693 // will put it out of sync with the actual state like whether we're | 2694 // will put it out of sync with the actual state like whether we're |
2694 // displaying a favicon, which controls the throbber. If we updated it here, | 2695 // displaying a favicon, which controls the throbber. If we updated it here, |
2695 // the throbber will show the default favicon for a split second when | 2696 // the throbber will show the default favicon for a split second when |
2696 // navigating away from the new tab page. | 2697 // navigating away from the new tab page. |
2697 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); | 2698 ScheduleUIUpdate(contents->web_contents(), content::INVALIDATE_TYPE_URL); |
2698 | 2699 |
2700 // In case of multiple windows we do not want to switch windows when this is | |
2701 // not user initiated (e.g. automatic page refresh) and the current window | |
2702 // is not the window we are targeting. | |
2703 if (!user_initiated && | |
sky
2012/05/21 16:42:50
Combine this with the Focus() request since that's
Mr4D (OOO till 08-26)
2012/05/21 17:15:43
Done.
| |
2704 (GetSelectedWebContents() != contents->web_contents() || | |
2705 !window()->GetNativeHandle()->HasFocus())) | |
2706 return; | |
2707 | |
2699 if (contents_is_selected) | 2708 if (contents_is_selected) |
2700 contents->web_contents()->Focus(); | 2709 contents->web_contents()->Focus(); |
2701 } | 2710 } |
2702 | 2711 |
2703 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { | 2712 void Browser::ShowCollectedCookiesDialog(TabContentsWrapper* wrapper) { |
2704 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); | 2713 browser::ShowCollectedCookiesDialog(window()->GetNativeHandle(), wrapper); |
2705 } | 2714 } |
2706 | 2715 |
2707 /////////////////////////////////////////////////////////////////////////////// | 2716 /////////////////////////////////////////////////////////////////////////////// |
2708 // Browser, PageNavigator implementation: | 2717 // Browser, PageNavigator implementation: |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3401 // Browser, content::WebContentsDelegate implementation: | 3410 // Browser, content::WebContentsDelegate implementation: |
3402 | 3411 |
3403 WebContents* Browser::OpenURLFromTab(WebContents* source, | 3412 WebContents* Browser::OpenURLFromTab(WebContents* source, |
3404 const OpenURLParams& params) { | 3413 const OpenURLParams& params) { |
3405 browser::NavigateParams nav_params(this, params.url, params.transition); | 3414 browser::NavigateParams nav_params(this, params.url, params.transition); |
3406 nav_params.source_contents = GetTabContentsWrapperAt( | 3415 nav_params.source_contents = GetTabContentsWrapperAt( |
3407 tab_strip_model_->GetWrapperIndex(source)); | 3416 tab_strip_model_->GetWrapperIndex(source)); |
3408 nav_params.referrer = params.referrer; | 3417 nav_params.referrer = params.referrer; |
3409 nav_params.disposition = params.disposition; | 3418 nav_params.disposition = params.disposition; |
3410 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 3419 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
3411 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | 3420 #if defined(USE_ASH) |
sky
2012/05/21 16:42:50
Again, I think you want this every where.
Mr4D (OOO till 08-26)
2012/05/21 17:15:43
Done.
| |
3421 // If the current tab is initiating this, we don't want to update. | |
3422 if (nav_params.window_action != browser::NavigateParams::NO_ACTION || | |
3423 params.disposition != CURRENT_TAB || | |
3424 (GetSelectedTabContentsWrapper() == nav_params.source_contents && | |
sky
2012/05/21 16:42:50
Can you use source instead of nav_aprams.source_co
Mr4D (OOO till 08-26)
2012/05/21 17:15:43
Done.
| |
3425 window()->GetNativeHandle()->HasFocus())) | |
sky
2012/05/21 16:42:50
window()->IsActive()
Mr4D (OOO till 08-26)
2012/05/21 17:15:43
Done.
| |
3426 #endif | |
3427 nav_params.window_action = browser::NavigateParams::SHOW_WINDOW; | |
3412 nav_params.user_gesture = true; | 3428 nav_params.user_gesture = true; |
3413 nav_params.override_encoding = params.override_encoding; | 3429 nav_params.override_encoding = params.override_encoding; |
3414 nav_params.is_renderer_initiated = params.is_renderer_initiated; | 3430 nav_params.is_renderer_initiated = params.is_renderer_initiated; |
3415 nav_params.transferred_global_request_id = | 3431 nav_params.transferred_global_request_id = |
3416 params.transferred_global_request_id; | 3432 params.transferred_global_request_id; |
3417 browser::Navigate(&nav_params); | 3433 browser::Navigate(&nav_params); |
3418 | 3434 |
3419 return nav_params.target_contents ? | 3435 return nav_params.target_contents ? |
3420 nav_params.target_contents->web_contents() : NULL; | 3436 nav_params.target_contents->web_contents() : NULL; |
3421 } | 3437 } |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5423 if (contents && !allow_js_access) { | 5439 if (contents && !allow_js_access) { |
5424 contents->web_contents()->GetController().LoadURL( | 5440 contents->web_contents()->GetController().LoadURL( |
5425 target_url, | 5441 target_url, |
5426 content::Referrer(), | 5442 content::Referrer(), |
5427 content::PAGE_TRANSITION_LINK, | 5443 content::PAGE_TRANSITION_LINK, |
5428 std::string()); // No extra headers. | 5444 std::string()); // No extra headers. |
5429 } | 5445 } |
5430 | 5446 |
5431 return contents != NULL; | 5447 return contents != NULL; |
5432 } | 5448 } |
OLD | NEW |