| 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 #import "ios/chrome/browser/ui/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 6 | 6 |
| 7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
| 8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
| 9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
| 10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 params.transition_type = transition; | 2036 params.transition_type = transition; |
| 2037 if (postData) { | 2037 if (postData) { |
| 2038 // Extract the content type and post params from |postData| and add them | 2038 // Extract the content type and post params from |postData| and add them |
| 2039 // to the load params. | 2039 // to the load params. |
| 2040 NSString* contentType = base::SysUTF8ToNSString(postData->first); | 2040 NSString* contentType = base::SysUTF8ToNSString(postData->first); |
| 2041 NSData* data = [NSData dataWithBytes:(void*)postData->second.data() | 2041 NSData* data = [NSData dataWithBytes:(void*)postData->second.data() |
| 2042 length:postData->second.length()]; | 2042 length:postData->second.length()]; |
| 2043 params.post_data.reset([data retain]); | 2043 params.post_data.reset([data retain]); |
| 2044 params.extra_headers.reset([@{ @"Content-Type" : contentType } retain]); | 2044 params.extra_headers.reset([@{ @"Content-Type" : contentType } retain]); |
| 2045 } | 2045 } |
| 2046 Tab* tab = [_model insertOrUpdateTabWithLoadParams:params | 2046 Tab* tab = [_model insertTabWithLoadParams:params |
| 2047 windowName:nil | 2047 opener:nil |
| 2048 opener:nil | 2048 openedByDOM:NO |
| 2049 openedByDOM:NO | 2049 atIndex:position |
| 2050 atIndex:position | 2050 inBackground:NO]; |
| 2051 inBackground:NO]; | |
| 2052 return tab; | 2051 return tab; |
| 2053 } | 2052 } |
| 2054 | 2053 |
| 2055 // Whether the given tab's url begins with the chrome prefix. | 2054 // Whether the given tab's url begins with the chrome prefix. |
| 2056 - (BOOL)isTabNativePage:(Tab*)tab { | 2055 - (BOOL)isTabNativePage:(Tab*)tab { |
| 2057 return tab && tab.url.SchemeIs(kChromeUIScheme); | 2056 return tab && tab.url.SchemeIs(kChromeUIScheme); |
| 2058 } | 2057 } |
| 2059 | 2058 |
| 2060 - (void)expectNewForegroundTab { | 2059 - (void)expectNewForegroundTab { |
| 2061 _expectingForegroundTab = YES; | 2060 _expectingForegroundTab = YES; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 } | 2349 } |
| 2351 | 2350 |
| 2352 #pragma mark - CRWWebStateDelegate methods. | 2351 #pragma mark - CRWWebStateDelegate methods. |
| 2353 | 2352 |
| 2354 - (web::WebState*)webState:(web::WebState*)webState | 2353 - (web::WebState*)webState:(web::WebState*)webState |
| 2355 openURLWithParams:(const web::WebState::OpenURLParams&)params { | 2354 openURLWithParams:(const web::WebState::OpenURLParams&)params { |
| 2356 switch (params.disposition) { | 2355 switch (params.disposition) { |
| 2357 case WindowOpenDisposition::NEW_FOREGROUND_TAB: | 2356 case WindowOpenDisposition::NEW_FOREGROUND_TAB: |
| 2358 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { | 2357 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { |
| 2359 Tab* tab = [[self tabModel] | 2358 Tab* tab = [[self tabModel] |
| 2360 insertOrUpdateTabWithURL:params.url | 2359 insertTabWithURL:params.url |
| 2361 referrer:params.referrer | 2360 referrer:params.referrer |
| 2362 transition:params.transition | 2361 transition:params.transition |
| 2363 windowName:nil | 2362 opener:LegacyTabHelper::GetTabForWebState(webState) |
| 2364 opener:LegacyTabHelper::GetTabForWebState(webState) | 2363 openedByDOM:NO |
| 2365 openedByDOM:NO | 2364 atIndex:TabModelConstants::kTabPositionAutomatically |
| 2366 atIndex:TabModelConstants::kTabPositionAutomatically | 2365 inBackground:(params.disposition == |
| 2367 inBackground:(params.disposition == | 2366 WindowOpenDisposition::NEW_BACKGROUND_TAB)]; |
| 2368 WindowOpenDisposition::NEW_BACKGROUND_TAB)]; | |
| 2369 return tab.webState; | 2367 return tab.webState; |
| 2370 } | 2368 } |
| 2371 case WindowOpenDisposition::CURRENT_TAB: { | 2369 case WindowOpenDisposition::CURRENT_TAB: { |
| 2372 web::NavigationManager::WebLoadParams loadParams(params.url); | 2370 web::NavigationManager::WebLoadParams loadParams(params.url); |
| 2373 loadParams.referrer = params.referrer; | 2371 loadParams.referrer = params.referrer; |
| 2374 loadParams.transition_type = params.transition; | 2372 loadParams.transition_type = params.transition; |
| 2375 loadParams.is_renderer_initiated = params.is_renderer_initiated; | 2373 loadParams.is_renderer_initiated = params.is_renderer_initiated; |
| 2376 webState->GetNavigationManager()->LoadURLWithParams(loadParams); | 2374 webState->GetNavigationManager()->LoadURLWithParams(loadParams); |
| 2377 return webState; | 2375 return webState; |
| 2378 } | 2376 } |
| 2379 case WindowOpenDisposition::NEW_POPUP: { | 2377 case WindowOpenDisposition::NEW_POPUP: { |
| 2380 Tab* tab = [[self tabModel] | 2378 Tab* tab = [[self tabModel] |
| 2381 insertOrUpdateTabWithURL:params.url | 2379 insertTabWithURL:params.url |
| 2382 referrer:params.referrer | 2380 referrer:params.referrer |
| 2383 transition:params.transition | 2381 transition:params.transition |
| 2384 windowName:nil | 2382 opener:LegacyTabHelper::GetTabForWebState(webState) |
| 2385 opener:LegacyTabHelper::GetTabForWebState(webState) | 2383 openedByDOM:YES |
| 2386 openedByDOM:YES | 2384 atIndex:TabModelConstants::kTabPositionAutomatically |
| 2387 atIndex:TabModelConstants::kTabPositionAutomatically | 2385 inBackground:NO]; |
| 2388 inBackground:NO]; | |
| 2389 return tab.webState; | 2386 return tab.webState; |
| 2390 } | 2387 } |
| 2391 default: | 2388 default: |
| 2392 NOTIMPLEMENTED(); | 2389 NOTIMPLEMENTED(); |
| 2393 return nullptr; | 2390 return nullptr; |
| 2394 }; | 2391 }; |
| 2395 } | 2392 } |
| 2396 | 2393 |
| 2397 - (BOOL)webState:(web::WebState*)webState | 2394 - (BOOL)webState:(web::WebState*)webState |
| 2398 handleContextMenu:(const web::ContextMenuParams&)params { | 2395 handleContextMenu:(const web::ContextMenuParams&)params { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 if (web::UrlHasWebScheme(link)) { | 2434 if (web::UrlHasWebScheme(link)) { |
| 2438 web::Referrer referrer([_model currentTab].url, params.referrer_policy); | 2435 web::Referrer referrer([_model currentTab].url, params.referrer_policy); |
| 2439 | 2436 |
| 2440 // Open in New Tab. | 2437 // Open in New Tab. |
| 2441 title = l10n_util::GetNSStringWithFixup( | 2438 title = l10n_util::GetNSStringWithFixup( |
| 2442 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB); | 2439 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWTAB); |
| 2443 action = ^{ | 2440 action = ^{ |
| 2444 Record(ACTION_OPEN_IN_NEW_TAB, isImage, isLink); | 2441 Record(ACTION_OPEN_IN_NEW_TAB, isImage, isLink); |
| 2445 [weakSelf webPageOrderedOpen:link | 2442 [weakSelf webPageOrderedOpen:link |
| 2446 referrer:referrer | 2443 referrer:referrer |
| 2447 windowName:nil | |
| 2448 inBackground:YES | 2444 inBackground:YES |
| 2449 appendTo:kCurrentTab]; | 2445 appendTo:kCurrentTab]; |
| 2450 }; | 2446 }; |
| 2451 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2447 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2452 if (!_isOffTheRecord) { | 2448 if (!_isOffTheRecord) { |
| 2453 // Open in Incognito Tab. | 2449 // Open in Incognito Tab. |
| 2454 title = l10n_util::GetNSStringWithFixup( | 2450 title = l10n_util::GetNSStringWithFixup( |
| 2455 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); | 2451 IDS_IOS_CONTENT_CONTEXT_OPENLINKNEWINCOGNITOTAB); |
| 2456 action = ^{ | 2452 action = ^{ |
| 2457 Record(ACTION_OPEN_IN_INCOGNITO_TAB, isImage, isLink); | 2453 Record(ACTION_OPEN_IN_INCOGNITO_TAB, isImage, isLink); |
| 2458 [weakSelf webPageOrderedOpen:link | 2454 [weakSelf webPageOrderedOpen:link |
| 2459 referrer:referrer | 2455 referrer:referrer |
| 2460 windowName:nil | |
| 2461 inIncognito:YES | 2456 inIncognito:YES |
| 2462 inBackground:NO | 2457 inBackground:NO |
| 2463 appendTo:kCurrentTab]; | 2458 appendTo:kCurrentTab]; |
| 2464 }; | 2459 }; |
| 2465 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2460 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2466 } | 2461 } |
| 2467 } | 2462 } |
| 2468 if (link.SchemeIsHTTPOrHTTPS() && | 2463 if (link.SchemeIsHTTPOrHTTPS() && |
| 2469 reading_list::switches::IsReadingListEnabled()) { | 2464 reading_list::switches::IsReadingListEnabled()) { |
| 2470 NSString* innerText = params.link_text; | 2465 NSString* innerText = params.link_text; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 rendererInitiated:YES]; | 2507 rendererInitiated:YES]; |
| 2513 }; | 2508 }; |
| 2514 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2509 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2515 // Open Image In New Tab. | 2510 // Open Image In New Tab. |
| 2516 title = l10n_util::GetNSStringWithFixup( | 2511 title = l10n_util::GetNSStringWithFixup( |
| 2517 IDS_IOS_CONTENT_CONTEXT_OPENIMAGENEWTAB); | 2512 IDS_IOS_CONTENT_CONTEXT_OPENIMAGENEWTAB); |
| 2518 action = ^{ | 2513 action = ^{ |
| 2519 Record(ACTION_OPEN_IMAGE_IN_NEW_TAB, isImage, isLink); | 2514 Record(ACTION_OPEN_IMAGE_IN_NEW_TAB, isImage, isLink); |
| 2520 [weakSelf webPageOrderedOpen:imageUrl | 2515 [weakSelf webPageOrderedOpen:imageUrl |
| 2521 referrer:referrer | 2516 referrer:referrer |
| 2522 windowName:nil | |
| 2523 inBackground:true | 2517 inBackground:true |
| 2524 appendTo:kCurrentTab]; | 2518 appendTo:kCurrentTab]; |
| 2525 }; | 2519 }; |
| 2526 [_contextMenuCoordinator addItemWithTitle:title action:action]; | 2520 [_contextMenuCoordinator addItemWithTitle:title action:action]; |
| 2527 | 2521 |
| 2528 TemplateURLService* service = | 2522 TemplateURLService* service = |
| 2529 ios::TemplateURLServiceFactory::GetForBrowserState(_browserState); | 2523 ios::TemplateURLServiceFactory::GetForBrowserState(_browserState); |
| 2530 TemplateURL* defaultURL = service->GetDefaultSearchProvider(); | 2524 TemplateURL* defaultURL = service->GetDefaultSearchProvider(); |
| 2531 if (defaultURL && !defaultURL->image_url().empty() && | 2525 if (defaultURL && !defaultURL->image_url().empty() && |
| 2532 defaultURL->image_url_ref().IsValid(service->search_terms_data())) { | 2526 defaultURL->image_url_ref().IsValid(service->search_terms_data())) { |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3348 } | 3342 } |
| 3349 | 3343 |
| 3350 - (void)hidePageInfoPopupForView:(UIView*)sourceView { | 3344 - (void)hidePageInfoPopupForView:(UIView*)sourceView { |
| 3351 [_pageInfoController dismiss]; | 3345 [_pageInfoController dismiss]; |
| 3352 _pageInfoController.reset(); | 3346 _pageInfoController.reset(); |
| 3353 } | 3347 } |
| 3354 | 3348 |
| 3355 - (void)showSecurityHelpPage { | 3349 - (void)showSecurityHelpPage { |
| 3356 [self webPageOrderedOpen:GURL(kPageInfoHelpCenterURL) | 3350 [self webPageOrderedOpen:GURL(kPageInfoHelpCenterURL) |
| 3357 referrer:web::Referrer() | 3351 referrer:web::Referrer() |
| 3358 windowName:nil | |
| 3359 inBackground:NO | 3352 inBackground:NO |
| 3360 appendTo:kCurrentTab]; | 3353 appendTo:kCurrentTab]; |
| 3361 [self hidePageInfoPopupForView:nil]; | 3354 [self hidePageInfoPopupForView:nil]; |
| 3362 } | 3355 } |
| 3363 | 3356 |
| 3364 - (void)showTabHistoryPopupForBackwardHistory { | 3357 - (void)showTabHistoryPopupForBackwardHistory { |
| 3365 DCHECK(self.visible || self.dismissingModal); | 3358 DCHECK(self.visible || self.dismissingModal); |
| 3366 | 3359 |
| 3367 // Dismiss the omnibox (if open). | 3360 // Dismiss the omnibox (if open). |
| 3368 [_toolbarController cancelOmniboxEdit]; | 3361 [_toolbarController cancelOmniboxEdit]; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 urlToLoad = [_preloadController prefetchedURL]; | 3606 urlToLoad = [_preloadController prefetchedURL]; |
| 3614 } | 3607 } |
| 3615 | 3608 |
| 3616 [_preloadController cancelPrerender]; | 3609 [_preloadController cancelPrerender]; |
| 3617 | 3610 |
| 3618 // Some URLs are not allowed while in incognito. If we are in incognito and | 3611 // Some URLs are not allowed while in incognito. If we are in incognito and |
| 3619 // load a disallowed URL, instead create a new tab not in the incognito state. | 3612 // load a disallowed URL, instead create a new tab not in the incognito state. |
| 3620 if (_isOffTheRecord && !IsURLAllowedInIncognito(url)) { | 3613 if (_isOffTheRecord && !IsURLAllowedInIncognito(url)) { |
| 3621 [self webPageOrderedOpen:url | 3614 [self webPageOrderedOpen:url |
| 3622 referrer:web::Referrer() | 3615 referrer:web::Referrer() |
| 3623 windowName:nil | |
| 3624 inIncognito:NO | 3616 inIncognito:NO |
| 3625 inBackground:NO | 3617 inBackground:NO |
| 3626 appendTo:kCurrentTab]; | 3618 appendTo:kCurrentTab]; |
| 3627 return; | 3619 return; |
| 3628 } | 3620 } |
| 3629 | 3621 |
| 3630 web::NavigationManager::WebLoadParams params(urlToLoad); | 3622 web::NavigationManager::WebLoadParams params(urlToLoad); |
| 3631 params.referrer = referrer; | 3623 params.referrer = referrer; |
| 3632 params.transition_type = transition; | 3624 params.transition_type = transition; |
| 3633 params.is_renderer_initiated = rendererInitiated; | 3625 params.is_renderer_initiated = rendererInitiated; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3652 // Ensure full screen height is updated. | 3644 // Ensure full screen height is updated. |
| 3653 Tab* currentTab = [_model currentTab]; | 3645 Tab* currentTab = [_model currentTab]; |
| 3654 BOOL visible = self.isToolbarOnScreen; | 3646 BOOL visible = self.isToolbarOnScreen; |
| 3655 [currentTab updateFullscreenWithToolbarVisible:visible]; | 3647 [currentTab updateFullscreenWithToolbarVisible:visible]; |
| 3656 } | 3648 } |
| 3657 } | 3649 } |
| 3658 | 3650 |
| 3659 // Load a new URL on a new page/tab. | 3651 // Load a new URL on a new page/tab. |
| 3660 - (void)webPageOrderedOpen:(const GURL&)URL | 3652 - (void)webPageOrderedOpen:(const GURL&)URL |
| 3661 referrer:(const web::Referrer&)referrer | 3653 referrer:(const web::Referrer&)referrer |
| 3662 windowName:(NSString*)windowName | |
| 3663 inBackground:(BOOL)inBackground | 3654 inBackground:(BOOL)inBackground |
| 3664 appendTo:(OpenPosition)appendTo { | 3655 appendTo:(OpenPosition)appendTo { |
| 3665 Tab* adjacentTab = nil; | 3656 Tab* adjacentTab = nil; |
| 3666 if (appendTo == kCurrentTab) | 3657 if (appendTo == kCurrentTab) |
| 3667 adjacentTab = [_model currentTab]; | 3658 adjacentTab = [_model currentTab]; |
| 3668 [_model insertOrUpdateTabWithURL:URL | 3659 [_model insertTabWithURL:URL |
| 3669 referrer:referrer | 3660 referrer:referrer |
| 3670 transition:ui::PAGE_TRANSITION_LINK | 3661 transition:ui::PAGE_TRANSITION_LINK |
| 3671 windowName:windowName | 3662 opener:adjacentTab |
| 3672 opener:adjacentTab | 3663 openedByDOM:NO |
| 3673 openedByDOM:NO | 3664 atIndex:TabModelConstants::kTabPositionAutomatically |
| 3674 atIndex:TabModelConstants::kTabPositionAutomatically | 3665 inBackground:inBackground]; |
| 3675 inBackground:inBackground]; | |
| 3676 } | 3666 } |
| 3677 | 3667 |
| 3678 - (void)webPageOrderedOpen:(const GURL&)url | 3668 - (void)webPageOrderedOpen:(const GURL&)url |
| 3679 referrer:(const web::Referrer&)referrer | 3669 referrer:(const web::Referrer&)referrer |
| 3680 windowName:(NSString*)windowName | |
| 3681 inIncognito:(BOOL)inIncognito | 3670 inIncognito:(BOOL)inIncognito |
| 3682 inBackground:(BOOL)inBackground | 3671 inBackground:(BOOL)inBackground |
| 3683 appendTo:(OpenPosition)appendTo { | 3672 appendTo:(OpenPosition)appendTo { |
| 3684 if (inIncognito == _isOffTheRecord) { | 3673 if (inIncognito == _isOffTheRecord) { |
| 3685 [self webPageOrderedOpen:url | 3674 [self webPageOrderedOpen:url |
| 3686 referrer:referrer | 3675 referrer:referrer |
| 3687 windowName:windowName | |
| 3688 inBackground:inBackground | 3676 inBackground:inBackground |
| 3689 appendTo:appendTo]; | 3677 appendTo:appendTo]; |
| 3690 return; | 3678 return; |
| 3691 } | 3679 } |
| 3692 // When sending an open command that switches modes, ensure the tab | 3680 // When sending an open command that switches modes, ensure the tab |
| 3693 // ends up appended to the end of the model, not just next to what is | 3681 // ends up appended to the end of the model, not just next to what is |
| 3694 // currently selected in the other mode. This is done with the |append| | 3682 // currently selected in the other mode. This is done with the |append| |
| 3695 // parameter. | 3683 // parameter. |
| 3696 base::scoped_nsobject<OpenUrlCommand> command([[OpenUrlCommand alloc] | 3684 base::scoped_nsobject<OpenUrlCommand> command([[OpenUrlCommand alloc] |
| 3697 initWithURL:url | 3685 initWithURL:url |
| 3698 referrer:web::Referrer() // Strip referrer when switching modes. | 3686 referrer:web::Referrer() // Strip referrer when switching modes. |
| 3699 windowName:windowName | |
| 3700 inIncognito:inIncognito | 3687 inIncognito:inIncognito |
| 3701 inBackground:inBackground | 3688 inBackground:inBackground |
| 3702 appendTo:kLastTab]); | 3689 appendTo:kLastTab]); |
| 3703 [self chromeExecuteCommand:command]; | 3690 [self chromeExecuteCommand:command]; |
| 3704 } | 3691 } |
| 3705 | 3692 |
| 3706 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { | 3693 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { |
| 3707 [[_model currentTab] loadSessionTab:sessionTab]; | 3694 [[_model currentTab] loadSessionTab:sessionTab]; |
| 3708 } | 3695 } |
| 3709 | 3696 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4123 // If no view controllers are presented, we should be ok with dispatching | 4110 // If no view controllers are presented, we should be ok with dispatching |
| 4124 // the completion block directly. | 4111 // the completion block directly. |
| 4125 dispatch_async(dispatch_get_main_queue(), completion); | 4112 dispatch_async(dispatch_get_main_queue(), completion); |
| 4126 } | 4113 } |
| 4127 } | 4114 } |
| 4128 | 4115 |
| 4129 - (void)showHelpPage { | 4116 - (void)showHelpPage { |
| 4130 GURL helpUrl(l10n_util::GetStringUTF16(IDS_IOS_TOOLS_MENU_HELP_URL)); | 4117 GURL helpUrl(l10n_util::GetStringUTF16(IDS_IOS_TOOLS_MENU_HELP_URL)); |
| 4131 [self webPageOrderedOpen:helpUrl | 4118 [self webPageOrderedOpen:helpUrl |
| 4132 referrer:web::Referrer() | 4119 referrer:web::Referrer() |
| 4133 windowName:nil | |
| 4134 inBackground:NO | 4120 inBackground:NO |
| 4135 appendTo:kCurrentTab]; | 4121 appendTo:kCurrentTab]; |
| 4136 } | 4122 } |
| 4137 | 4123 |
| 4138 - (void)enableDesktopUserAgent { | 4124 - (void)enableDesktopUserAgent { |
| 4139 [[_model currentTab] enableDesktopUserAgent]; | 4125 [[_model currentTab] enableDesktopUserAgent]; |
| 4140 [[_model currentTab] reloadForDesktopUserAgent]; | 4126 [[_model currentTab] reloadForDesktopUserAgent]; |
| 4141 } | 4127 } |
| 4142 | 4128 |
| 4143 - (void)resetAllWebViews { | 4129 - (void)resetAllWebViews { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4335 if (!strongTab) | 4321 if (!strongTab) |
| 4336 return; | 4322 return; |
| 4337 if (![result isKindOfClass:[NSString class]]) | 4323 if (![result isKindOfClass:[NSString class]]) |
| 4338 result = @"Not an HTML page"; | 4324 result = @"Not an HTML page"; |
| 4339 std::string base64HTML; | 4325 std::string base64HTML; |
| 4340 base::Base64Encode(base::SysNSStringToUTF8(result), &base64HTML); | 4326 base::Base64Encode(base::SysNSStringToUTF8(result), &base64HTML); |
| 4341 GURL URL(std::string("data:text/plain;charset=utf-8;base64,") + base64HTML); | 4327 GURL URL(std::string("data:text/plain;charset=utf-8;base64,") + base64HTML); |
| 4342 web::Referrer referrer([strongTab url], web::ReferrerPolicyDefault); | 4328 web::Referrer referrer([strongTab url], web::ReferrerPolicyDefault); |
| 4343 | 4329 |
| 4344 [[weakSelf tabModel] | 4330 [[weakSelf tabModel] |
| 4345 insertOrUpdateTabWithURL:URL | 4331 insertTabWithURL:URL |
| 4346 referrer:referrer | 4332 referrer:referrer |
| 4347 transition:ui::PAGE_TRANSITION_LINK | 4333 transition:ui::PAGE_TRANSITION_LINK |
| 4348 windowName:nil | 4334 opener:strongTab |
| 4349 opener:strongTab | 4335 openedByDOM:YES |
| 4350 openedByDOM:YES | 4336 atIndex:TabModelConstants::kTabPositionAutomatically |
| 4351 atIndex:TabModelConstants::kTabPositionAutomatically | 4337 inBackground:NO]; |
| 4352 inBackground:NO]; | |
| 4353 }; | 4338 }; |
| 4354 [webController executeJavaScript:script | 4339 [webController executeJavaScript:script |
| 4355 completionHandler:completionHandlerBlock]; | 4340 completionHandler:completionHandlerBlock]; |
| 4356 } | 4341 } |
| 4357 #endif // !defined(NDEBUG) | 4342 #endif // !defined(NDEBUG) |
| 4358 | 4343 |
| 4359 - (void)startVoiceSearch { | 4344 - (void)startVoiceSearch { |
| 4360 // Delay Voice Search until new tab animations have finished. | 4345 // Delay Voice Search until new tab animations have finished. |
| 4361 if (_inNewTabAnimation) { | 4346 if (_inNewTabAnimation) { |
| 4362 _startVoiceSearchAfterNewTabAnimation = YES; | 4347 _startVoiceSearchAfterNewTabAnimation = YES; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5025 | 5010 |
| 5026 - (UIView*)voiceSearchButton { | 5011 - (UIView*)voiceSearchButton { |
| 5027 return _voiceSearchButton; | 5012 return _voiceSearchButton; |
| 5028 } | 5013 } |
| 5029 | 5014 |
| 5030 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5015 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5031 return [self currentLogoAnimationControllerOwner]; | 5016 return [self currentLogoAnimationControllerOwner]; |
| 5032 } | 5017 } |
| 5033 | 5018 |
| 5034 @end | 5019 @end |
| OLD | NEW |