Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 9688019: Add a Content API around BrowserURLHandler. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix gypis Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/browser_url_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/omnibox/location_bar.h" 28 #include "chrome/browser/ui/omnibox/location_bar.h"
29 #include "chrome/browser/ui/status_bubble.h" 29 #include "chrome/browser/ui/status_bubble.h"
30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
31 #include "chrome/browser/web_applications/web_app.h" 31 #include "chrome/browser/web_applications/web_app.h"
32 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/extensions/extension.h" 33 #include "chrome/common/extensions/extension.h"
34 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
35 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
36 #include "content/browser/browser_url_handler.h" 36 #include "content/public/browser/browser_url_handler.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/render_view_host.h" 38 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/render_view_host_delegate.h" 39 #include "content/public/browser/render_view_host_delegate.h"
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
41 #include "net/http/http_util.h" 41 #include "net/http/http_util.h"
42 42
43 using content::GlobalRequestID; 43 using content::GlobalRequestID;
44 using content::WebContents; 44 using content::WebContents;
45 45
46 namespace { 46 namespace {
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 // the URL specified in |params|. 627 // the URL specified in |params|.
628 int GetIndexOfSingletonTab(browser::NavigateParams* params) { 628 int GetIndexOfSingletonTab(browser::NavigateParams* params) {
629 if (params->disposition != SINGLETON_TAB) 629 if (params->disposition != SINGLETON_TAB)
630 return -1; 630 return -1;
631 631
632 // In case the URL was rewritten by the BrowserURLHandler we need to ensure 632 // In case the URL was rewritten by the BrowserURLHandler we need to ensure
633 // that we do not open another URL that will get redirected to the rewritten 633 // that we do not open another URL that will get redirected to the rewritten
634 // URL. 634 // URL.
635 GURL rewritten_url(params->url); 635 GURL rewritten_url(params->url);
636 bool reverse_on_redirect = false; 636 bool reverse_on_redirect = false;
637 BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 637 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
638 &rewritten_url, 638 &rewritten_url,
639 params->browser->profile(), 639 params->browser->profile(),
640 &reverse_on_redirect); 640 &reverse_on_redirect);
641 641
642 // If there are several matches: prefer the active tab by starting there. 642 // If there are several matches: prefer the active tab by starting there.
643 int start_index = std::max(0, params->browser->active_index()); 643 int start_index = std::max(0, params->browser->active_index());
644 int tab_count = params->browser->tab_count(); 644 int tab_count = params->browser->tab_count();
645 for (int i = 0; i < tab_count; ++i) { 645 for (int i = 0; i < tab_count; ++i) {
646 int tab_index = (start_index + i) % tab_count; 646 int tab_index = (start_index + i) % tab_count;
647 TabContentsWrapper* tab = 647 TabContentsWrapper* tab =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 popup_bounds.height() > max_height || 697 popup_bounds.height() > max_height ||
698 popup_bounds.width() == 0 || 698 popup_bounds.width() == 0 ||
699 popup_bounds.height() == 0) { 699 popup_bounds.height() == 0) {
700 return NEW_FOREGROUND_TAB; 700 return NEW_FOREGROUND_TAB;
701 } 701 }
702 return NEW_POPUP; 702 return NEW_POPUP;
703 } 703 }
704 #endif 704 #endif
705 705
706 } // namespace browser 706 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/browser_url_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698