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

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

Issue 3105004: Adds support for showing the match preview on views. It's behind the (Closed)
Patch Set: Addressed review comments Created 10 years, 4 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
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/tab_contents/match_preview.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "chrome/browser/profile.h" 63 #include "chrome/browser/profile.h"
64 #include "chrome/browser/renderer_host/render_view_host.h" 64 #include "chrome/browser/renderer_host/render_view_host.h"
65 #include "chrome/browser/renderer_host/site_instance.h" 65 #include "chrome/browser/renderer_host/site_instance.h"
66 #include "chrome/browser/sessions/session_service.h" 66 #include "chrome/browser/sessions/session_service.h"
67 #include "chrome/browser/sessions/session_types.h" 67 #include "chrome/browser/sessions/session_types.h"
68 #include "chrome/browser/status_bubble.h" 68 #include "chrome/browser/status_bubble.h"
69 #include "chrome/browser/sync/profile_sync_service.h" 69 #include "chrome/browser/sync/profile_sync_service.h"
70 #include "chrome/browser/sync/sync_ui_util.h" 70 #include "chrome/browser/sync/sync_ui_util.h"
71 #include "chrome/browser/tab_closeable_state_watcher.h" 71 #include "chrome/browser/tab_closeable_state_watcher.h"
72 #include "chrome/browser/tab_contents/interstitial_page.h" 72 #include "chrome/browser/tab_contents/interstitial_page.h"
73 #include "chrome/browser/tab_contents/match_preview.h"
73 #include "chrome/browser/tab_contents/navigation_controller.h" 74 #include "chrome/browser/tab_contents/navigation_controller.h"
74 #include "chrome/browser/tab_contents/navigation_entry.h" 75 #include "chrome/browser/tab_contents/navigation_entry.h"
75 #include "chrome/browser/tab_contents/tab_contents.h" 76 #include "chrome/browser/tab_contents/tab_contents.h"
76 #include "chrome/browser/tab_contents/tab_contents_view.h" 77 #include "chrome/browser/tab_contents/tab_contents_view.h"
77 #include "chrome/browser/tab_menu_model.h" 78 #include "chrome/browser/tab_menu_model.h"
78 #include "chrome/browser/upgrade_detector.h" 79 #include "chrome/browser/upgrade_detector.h"
79 #include "chrome/browser/web_applications/web_app.h" 80 #include "chrome/browser/web_applications/web_app.h"
80 #include "chrome/browser/window_sizer.h" 81 #include "chrome/browser/window_sizer.h"
81 #include "chrome/common/chrome_constants.h" 82 #include "chrome/common/chrome_constants.h"
82 #include "chrome/common/chrome_switches.h" 83 #include "chrome/common/chrome_switches.h"
(...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 2939
2939 Browser* Browser::GetBrowser() { 2940 Browser* Browser::GetBrowser() {
2940 return this; 2941 return this;
2941 } 2942 }
2942 2943
2943 void Browser::ContentTypeChanged(TabContents* source) { 2944 void Browser::ContentTypeChanged(TabContents* source) {
2944 if (source == GetSelectedTabContents()) 2945 if (source == GetSelectedTabContents())
2945 UpdateZoomCommandsForTabState(); 2946 UpdateZoomCommandsForTabState();
2946 } 2947 }
2947 2948
2949 void Browser::CommitMatchPreview(TabContents* source) {
2950 int index = tabstrip_model_.GetIndexOfTabContents(source);
2951 DCHECK_NE(-1, index);
2952 TabContents* preview_contents =
2953 source->match_preview()->ReleasePreviewContents();
2954 // TabStripModel takes ownership of preview_contents.
2955 tabstrip_model_.ReplaceTabContentsAt(
2956 index, preview_contents, TabStripModelObserver::REPLACE_MATCH_PREVIEW);
2957 }
2958
2948 /////////////////////////////////////////////////////////////////////////////// 2959 ///////////////////////////////////////////////////////////////////////////////
2949 // Browser, SelectFileDialog::Listener implementation: 2960 // Browser, SelectFileDialog::Listener implementation:
2950 2961
2951 void Browser::FileSelected(const FilePath& path, int index, void* params) { 2962 void Browser::FileSelected(const FilePath& path, int index, void* params) {
2952 profile_->set_last_selected_directory(path.DirName()); 2963 profile_->set_last_selected_directory(path.DirName());
2953 GURL file_url = net::FilePathToFileURL(path); 2964 GURL file_url = net::FilePathToFileURL(path);
2954 if (!file_url.is_empty()) 2965 if (!file_url.is_empty())
2955 OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 2966 OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
2956 } 2967 }
2957 2968
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4080 } 4091 }
4081 4092
4082 bool Browser::IsPinned(TabContents* source) { 4093 bool Browser::IsPinned(TabContents* source) {
4083 int index = tabstrip_model_.GetIndexOfTabContents(source); 4094 int index = tabstrip_model_.GetIndexOfTabContents(source);
4084 if (index == TabStripModel::kNoTab) { 4095 if (index == TabStripModel::kNoTab) {
4085 NOTREACHED() << "IsPinned called for tab not in our strip"; 4096 NOTREACHED() << "IsPinned called for tab not in our strip";
4086 return false; 4097 return false;
4087 } 4098 }
4088 return tabstrip_model_.IsTabPinned(index); 4099 return tabstrip_model_.IsTabPinned(index);
4089 } 4100 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/tab_contents/match_preview.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698