Fixes CRLF and trailing white spaces.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10982 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
@@ -90,12 +90,12 @@ void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) {
|
||||
Sleep(30);
|
||||
|
||||
watcher.StopWatching();
|
||||
|
||||
|
||||
MessageLoop::current()->RunAllPending();
|
||||
|
||||
// Our delegate should not have fired.
|
||||
EXPECT_EQ(1, counter);
|
||||
|
||||
|
||||
CloseHandle(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class ObserverListThreadSafe
|
||||
// ObserverList. This function MUST be called on the thread which owns
|
||||
// the unsafe ObserverList.
|
||||
template <class Method, class Params>
|
||||
void NotifyWrapper(ObserverList<ObserverType>* list,
|
||||
void NotifyWrapper(ObserverList<ObserverType>* list,
|
||||
const UnboundMethod<ObserverType, Method, Params>& method) {
|
||||
|
||||
// Check that this list still needs notifications.
|
||||
|
||||
@@ -158,7 +158,7 @@ const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
|
||||
if (result) {
|
||||
return &entry_;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -167,14 +167,14 @@ bool NamedProcessIterator::CheckForNextProcess() {
|
||||
|
||||
std::string data;
|
||||
std::string exec_name;
|
||||
|
||||
|
||||
for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
|
||||
kinfo_proc* kinfo = &kinfo_procs_[index_of_kinfo_proc_];
|
||||
|
||||
// Skip processes just awaiting collection
|
||||
if ((kinfo->kp_proc.p_pid > 0) && (kinfo->kp_proc.p_stat == SZOMB))
|
||||
continue;
|
||||
|
||||
|
||||
int mib[] = { CTL_KERN, KERN_PROCARGS, kinfo->kp_proc.p_pid };
|
||||
|
||||
// Found out what size buffer we need
|
||||
@@ -183,13 +183,13 @@ bool NamedProcessIterator::CheckForNextProcess() {
|
||||
LOG(ERROR) << "failed to figure out the buffer size for a commandline";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
data.resize(data_len);
|
||||
if (sysctl(mib, arraysize(mib), &data[0], &data_len, NULL, 0) < 0) {
|
||||
LOG(ERROR) << "failed to fetch a commandline";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Data starts w/ the full path null termed, so we have to extract just the
|
||||
// executable name from the path.
|
||||
|
||||
@@ -203,7 +203,7 @@ bool NamedProcessIterator::CheckForNextProcess() {
|
||||
exec_name = data.substr(0, exec_name_end);
|
||||
else
|
||||
exec_name = data.substr(last_slash + 1, exec_name_end - last_slash - 1);
|
||||
|
||||
|
||||
// Check the name
|
||||
if (executable_name_utf8 == exec_name) {
|
||||
entry_.pid = kinfo->kp_proc.p_pid;
|
||||
|
||||
+20
-20
@@ -129,27 +129,27 @@ TimeTicks TimeTicks::Now() {
|
||||
static mach_timebase_info_data_t timebase_info;
|
||||
if (timebase_info.denom == 0) {
|
||||
// Zero-initialization of statics guarantees that denom will be 0 before
|
||||
// calling mach_timebase_info. mach_timebase_info will never set denom to
|
||||
// 0 as that would be invalid, so the zero-check can be used to determine
|
||||
// whether mach_timebase_info has already been called. This is
|
||||
// recommended by Apple's QA1398.
|
||||
kern_return_t kr = mach_timebase_info(&timebase_info);
|
||||
DCHECK(kr == KERN_SUCCESS);
|
||||
}
|
||||
// calling mach_timebase_info. mach_timebase_info will never set denom to
|
||||
// 0 as that would be invalid, so the zero-check can be used to determine
|
||||
// whether mach_timebase_info has already been called. This is
|
||||
// recommended by Apple's QA1398.
|
||||
kern_return_t kr = mach_timebase_info(&timebase_info);
|
||||
DCHECK(kr == KERN_SUCCESS);
|
||||
}
|
||||
|
||||
// mach_absolute_time is it when it comes to ticks on the Mac. Other calls
|
||||
// with less precision (such as TickCount) just call through to
|
||||
// mach_absolute_time.
|
||||
|
||||
// timebase_info converts absolute time tick units into nanoseconds. Convert
|
||||
// to microseconds up front to stave off overflows.
|
||||
absolute_micro = mach_absolute_time() / Time::kNanosecondsPerMicrosecond *
|
||||
timebase_info.numer / timebase_info.denom;
|
||||
|
||||
// Don't bother with the rollover handling that the Windows version does.
|
||||
// With numer and denom = 1 (the expected case), the 64-bit absolute time
|
||||
// reported in nanoseconds is enough to last nearly 585 years.
|
||||
|
||||
// mach_absolute_time is it when it comes to ticks on the Mac. Other calls
|
||||
// with less precision (such as TickCount) just call through to
|
||||
// mach_absolute_time.
|
||||
|
||||
// timebase_info converts absolute time tick units into nanoseconds. Convert
|
||||
// to microseconds up front to stave off overflows.
|
||||
absolute_micro = mach_absolute_time() / Time::kNanosecondsPerMicrosecond *
|
||||
timebase_info.numer / timebase_info.denom;
|
||||
|
||||
// Don't bother with the rollover handling that the Windows version does.
|
||||
// With numer and denom = 1 (the expected case), the 64-bit absolute time
|
||||
// reported in nanoseconds is enough to last nearly 585 years.
|
||||
|
||||
#elif defined(OS_POSIX) && \
|
||||
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ TEST(TimeTicks, WinRollover) {
|
||||
|
||||
TEST(TimeTicks, SubMillisecondTimers) {
|
||||
// Loop for a bit getting timers quickly. We want to
|
||||
// see at least one case where we get a new sample in
|
||||
// see at least one case where we get a new sample in
|
||||
// less than one millisecond.
|
||||
bool saw_submillisecond_timer = false;
|
||||
int64 min_timer = 1000;
|
||||
|
||||
@@ -139,7 +139,7 @@ void TraceLog::Trace(const std::string& name,
|
||||
name.c_str(),
|
||||
id,
|
||||
extra.c_str(),
|
||||
file,
|
||||
file,
|
||||
line,
|
||||
usec);
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ bool IncorrectChromeHtmlArguments(const std::wstring& command_line) {
|
||||
// The browser is being launched with chromehtml: somewhere on the command
|
||||
// line. We will not launch unless it's preceded by the -- switch terminator.
|
||||
if (pos >= kOffset) {
|
||||
if (equal(kChromeHtml, kChromeHtml + arraysize(kChromeHtml) - 1,
|
||||
if (equal(kChromeHtml, kChromeHtml + arraysize(kChromeHtml) - 1,
|
||||
command_line_lower.begin() + pos - kOffset)) {
|
||||
return false;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ int ChromeMain(int argc, const char** argv) {
|
||||
// The exit manager is in charge of calling the dtors of singleton objects.
|
||||
base::AtExitManager exit_manager;
|
||||
|
||||
// We need this pool for all the objects created before we get to the
|
||||
// We need this pool for all the objects created before we get to the
|
||||
// event loop, but we don't want to leave them hanging around until the
|
||||
// app quits. Each "main" needs to flush this pool right before it goes into
|
||||
// its main event loop to get rid of the cruft.
|
||||
|
||||
@@ -23,9 +23,9 @@ int main(int argc, const char** argv) {
|
||||
|
||||
// The exit manager is in charge of calling the dtors of singletons.
|
||||
// Win has one here, but we assert with multiples from BrowserMain() if we
|
||||
// keep it.
|
||||
// keep it.
|
||||
// base::AtExitManager exit_manager;
|
||||
|
||||
|
||||
#if defined(GOOGLE_CHROME_BUILD)
|
||||
// TODO(pinkerton): init crash reporter
|
||||
#endif
|
||||
|
||||
@@ -40,12 +40,12 @@
|
||||
// We can't use the standard terminate: method because it will abruptly exit
|
||||
// the app and leave things on the stack in an unfinalized state. We need to
|
||||
// post a quit message to our run loop so the stack can gracefully unwind.
|
||||
- (IBAction)quit:(id)sender {
|
||||
- (IBAction)quit:(id)sender {
|
||||
// TODO(pinkerton):
|
||||
// since we have to roll it ourselves, ask the delegate (ourselves, really)
|
||||
// if we should terminate. For example, we might not want to if the user
|
||||
// has ongoing downloads or multiple windows/tabs open. However, this would
|
||||
// require posting UI and may require spinning up another run loop to
|
||||
// require posting UI and may require spinning up another run loop to
|
||||
// handle it. If it says to continue, post the quit message, otherwise
|
||||
// go back to normal.
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
// Close all the windows.
|
||||
BrowserList::CloseAllBrowsers(true);
|
||||
|
||||
|
||||
// Release the reference to the browser process. Once all the browsers get
|
||||
// dealloc'd, it will stop the RunLoop and fall back into main().
|
||||
g_browser_process->ReleaseModule();
|
||||
@@ -89,7 +89,7 @@
|
||||
- (void)commandDispatch:(id)sender {
|
||||
// How to get the profile created on line 314 of browser_main? Ugh. TODO:FIXME
|
||||
Profile* default_profile = *g_browser_process->profile_manager()->begin();
|
||||
|
||||
|
||||
NSInteger tag = [sender tag];
|
||||
switch (tag) {
|
||||
case IDC_NEW_WINDOW:
|
||||
|
||||
@@ -148,7 +148,7 @@ bool AutocompleteEditModel::GetURLForText(const std::wstring& text,
|
||||
UserTextFromDisplayText(text), std::wstring(), &parts, NULL);
|
||||
if (type != AutocompleteInput::URL)
|
||||
return false;
|
||||
|
||||
|
||||
*url = GURL(URLFixerUpper::FixupURL(WideToUTF8(text), std::string()));
|
||||
return true;
|
||||
}
|
||||
@@ -346,12 +346,12 @@ bool AutocompleteEditModel::OnEscapeKeyPressed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the user wasn't editing, but merely had focus in the edit, allow <esc>
|
||||
// to be processed as an accelerator, so it can still be used to stop a load.
|
||||
// When the permanent text isn't all selected we still fall through to the
|
||||
// SelectAll() call below so users can arrow around in the text and then hit
|
||||
// If the user wasn't editing, but merely had focus in the edit, allow <esc>
|
||||
// to be processed as an accelerator, so it can still be used to stop a load.
|
||||
// When the permanent text isn't all selected we still fall through to the
|
||||
// SelectAll() call below so users can arrow around in the text and then hit
|
||||
// <esc> to quickly replace all the text; this matches IE.
|
||||
if (!user_input_in_progress_ && view_->IsSelectAll())
|
||||
if (!user_input_in_progress_ && view_->IsSelectAll())
|
||||
return false;
|
||||
|
||||
view_->RevertAll();
|
||||
|
||||
@@ -593,7 +593,7 @@ void AutocompleteEditViewWin::Update(
|
||||
CHARRANGE sel;
|
||||
GetSelection(sel);
|
||||
const bool was_reversed = (sel.cpMin > sel.cpMax);
|
||||
const bool was_sel_all = (sel.cpMin != sel.cpMax) &&
|
||||
const bool was_sel_all = (sel.cpMin != sel.cpMax) &&
|
||||
IsSelectAllForRange(sel);
|
||||
|
||||
RevertAll();
|
||||
|
||||
@@ -125,7 +125,7 @@ void SearchProvider::OnURLFetchComplete(const URLFetcher* source,
|
||||
// TODO(jungshik): Switch to CodePageToUTF8 after it's added.
|
||||
if (CodepageToWide(data, charset.c_str(),
|
||||
OnStringUtilConversionError::FAIL, &wide_data))
|
||||
json_data = WideToUTF8(wide_data);
|
||||
json_data = WideToUTF8(wide_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ bool BookmarkCodec::DecodeNode(BookmarkModel* model,
|
||||
if (!DecodeChildren(model, *static_cast<ListValue*>(child_values), node))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
node->SetTitle(title);
|
||||
node->date_added_ = Time::FromInternalValue(
|
||||
StringToInt64(WideToUTF16Hack(date_added_string)));
|
||||
|
||||
@@ -271,7 +271,7 @@ BookmarkContextMenu::BookmarkContextMenu(
|
||||
menu_->AppendMenuItemWithLabel(
|
||||
IDS_BOOKMARK_BAR_REMOVE,
|
||||
l10n_util::GetString(IDS_BOOKMARK_BAR_REMOVE));
|
||||
|
||||
|
||||
if (configuration == BOOKMARK_MANAGER_TABLE ||
|
||||
configuration == BOOKMARK_MANAGER_TABLE_OTHER ||
|
||||
configuration == BOOKMARK_MANAGER_ORGANIZE_MENU ||
|
||||
|
||||
@@ -22,7 +22,7 @@ class Browser;
|
||||
class PageNavigator;
|
||||
|
||||
// BookmarkContextMenu manages the context menu shown for the
|
||||
// bookmark bar, items on the bookmark bar, submenus of the bookmark bar and
|
||||
// bookmark bar, items on the bookmark bar, submenus of the bookmark bar and
|
||||
// the bookmark manager.
|
||||
class BookmarkContextMenu : public views::MenuDelegate,
|
||||
public BookmarkModelObserver {
|
||||
|
||||
@@ -78,7 +78,7 @@ class BookmarkDropInfo {
|
||||
|
||||
// Used when autoscrolling.
|
||||
base::RepeatingTimer<BookmarkDropInfo> scroll_timer_;
|
||||
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BookmarkDropInfo);
|
||||
};
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ void WriteBookmarks(MessageLoop* thread,
|
||||
// for the duration of the write), as such we make a copy of the
|
||||
// BookmarkModel using BookmarkCodec then write from that.
|
||||
BookmarkCodec codec;
|
||||
scoped_ptr<Writer> writer(new Writer(codec.Encode(model),
|
||||
scoped_ptr<Writer> writer(new Writer(codec.Encode(model),
|
||||
FilePath::FromWStringHack(path)));
|
||||
if (thread)
|
||||
thread->PostTask(FROM_HERE, writer.release());
|
||||
|
||||
@@ -274,7 +274,7 @@ BookmarkTableModel* BookmarkTableModel::CreateBookmarkTableModelForFolder(
|
||||
BookmarkTableModel* BookmarkTableModel::CreateSearchTableModel(
|
||||
BookmarkModel* model,
|
||||
const std::wstring& text) {
|
||||
return new BookmarkSearchTableModel(model, text);
|
||||
return new BookmarkSearchTableModel(model, text);
|
||||
}
|
||||
|
||||
BookmarkTableModel::BookmarkTableModel(BookmarkModel* model)
|
||||
|
||||
@@ -254,7 +254,7 @@ void OpenAll(gfx::NativeWindow parent,
|
||||
|
||||
NewBrowserPageNavigator navigator_impl(profile);
|
||||
if (!navigator) {
|
||||
Browser* browser =
|
||||
Browser* browser =
|
||||
BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL);
|
||||
if (!browser || !browser->GetSelectedTabContents()) {
|
||||
navigator = &navigator_impl;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
- (void)dealloc {
|
||||
[self removeTrackingArea:trackingArea_];
|
||||
[trackingArea_ release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "chrome/browser/cocoa/browser_window_cocoa.h"
|
||||
#include "chrome/browser/cocoa/browser_window_controller.h"
|
||||
|
||||
BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller,
|
||||
BrowserWindowCocoa::BrowserWindowCocoa(BrowserWindowController* controller,
|
||||
NSWindow* window)
|
||||
: controller_(controller), window_(window) {
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
|
||||
bounds.height());
|
||||
// flip coordinates
|
||||
NSScreen* screen = [window_ screen];
|
||||
cocoa_bounds.origin.y =
|
||||
cocoa_bounds.origin.y =
|
||||
[screen frame].size.height - bounds.height() - bounds.y();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ void BrowserWindowCocoa::Activate() {
|
||||
}
|
||||
|
||||
void BrowserWindowCocoa::FlashFrame() {
|
||||
[[NSApplication sharedApplication]
|
||||
[[NSApplication sharedApplication]
|
||||
requestUserAttention:NSInformationalRequest];
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void BrowserWindowCocoa::UpdateStopGoState(bool is_loading) {
|
||||
|
||||
void BrowserWindowCocoa::UpdateToolbar(TabContents* contents,
|
||||
bool should_restore_state) {
|
||||
[controller_ updateToolbarWithContents:contents
|
||||
[controller_ updateToolbarWithContents:contents
|
||||
shouldRestoreState:should_restore_state ? YES : NO];
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate,
|
||||
void* parent_window) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
void BrowserWindowCocoa::DestroyBrowser() {
|
||||
[controller_ destroyBrowser];
|
||||
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
- (void)windowDidLoad {
|
||||
// Create a controller for the tab strip, giving it the model object for
|
||||
// this window's Browser and the tab strip view. The controller will handle
|
||||
// registering for the appropriate tab notifications from the back-end and
|
||||
// registering for the appropriate tab notifications from the back-end and
|
||||
// managing the creation of new tabs.
|
||||
tabStripController_ =
|
||||
tabStripController_ =
|
||||
[[TabStripController alloc]
|
||||
initWithView:tabStripView_
|
||||
initWithView:tabStripView_
|
||||
tabModel:browser_->tabstrip_model()
|
||||
toolbarModel:browser_->toolbar_model()
|
||||
commands:browser_->command_updater()];
|
||||
@@ -67,7 +67,7 @@
|
||||
// from this method.
|
||||
- (void)windowWillClose:(NSNotification *)notification {
|
||||
DCHECK(!browser_->tabstrip_model()->count());
|
||||
|
||||
|
||||
// We can't acutally use |-autorelease| here because there's an embedded
|
||||
// run loop in the |-performClose:| which contains its own autorelease pool.
|
||||
// Instead we use call it after a zero-length delay, which gets us back
|
||||
@@ -150,7 +150,7 @@
|
||||
// in the coordinate system of the content area of the currently selected tab.
|
||||
// |windowGrowBox| needs to be in the window's coordinate system.
|
||||
- (NSRect)selectedTabGrowBoxRect {
|
||||
return [tabStripController_
|
||||
return [tabStripController_
|
||||
selectedTabGrowBoxRect];
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
// Called to start/stop the loading animations.
|
||||
- (void)updateLoadingAnimations:(BOOL)animate {
|
||||
if (animate) {
|
||||
// TODO(pinkerton): determine what throbber animation is necessary and
|
||||
// TODO(pinkerton): determine what throbber animation is necessary and
|
||||
// start a timer to periodically update. Windows tells the tab strip to
|
||||
// do this. It uses a single timer to coalesce the multiple things that
|
||||
// could be updating. http://crbug.com/8281
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
// Draws the "grow_box" image in our bounds.
|
||||
- (void)drawRect:(NSRect)dirtyRect {
|
||||
[image_ drawInRect:[self bounds] fromRect:NSZeroRect
|
||||
[image_ drawInRect:[self bounds] fromRect:NSZeroRect
|
||||
operation:NSCompositeSourceOver fraction:1.0];
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,17 @@ static const int kTitleMessageSpacing = 15;
|
||||
base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_TITLE));
|
||||
NSString* message =
|
||||
base::SysWideToNSString(l10n_util::GetString(IDS_SAD_TAB_MESSAGE));
|
||||
|
||||
|
||||
NSColor* textColor = [NSColor whiteColor];
|
||||
NSColor* backgroundColor = [NSColor colorWithCalibratedRed:(35.0f/255.0f)
|
||||
green:(48.0f/255.0f)
|
||||
blue:(64.0f/255.0f)
|
||||
alpha:1.0];
|
||||
|
||||
|
||||
// Layout
|
||||
NSFont* titleFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]];
|
||||
NSFont* messageFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
|
||||
|
||||
|
||||
NSDictionary* titleAttrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
titleFont, NSFontAttributeName,
|
||||
textColor, NSForegroundColorAttributeName,
|
||||
@@ -39,23 +39,23 @@ static const int kTitleMessageSpacing = 15;
|
||||
messageFont, NSFontAttributeName,
|
||||
textColor, NSForegroundColorAttributeName,
|
||||
nil];
|
||||
|
||||
|
||||
NSAttributedString* titleString =
|
||||
[[[NSAttributedString alloc] initWithString:title
|
||||
attributes:titleAttrs] autorelease];
|
||||
NSAttributedString* messageString =
|
||||
[[[NSAttributedString alloc] initWithString:message
|
||||
attributes:messageAttrs] autorelease];
|
||||
|
||||
|
||||
NSRect viewBounds = [self bounds];
|
||||
|
||||
|
||||
NSSize sadTabImageSize = [sadTabImage size];
|
||||
CGFloat iconWidth = sadTabImageSize.width;
|
||||
CGFloat iconHeight = sadTabImageSize.height;
|
||||
CGFloat iconX = (viewBounds.size.width - iconWidth) / 2;
|
||||
CGFloat iconY =
|
||||
((viewBounds.size.height - iconHeight) / 2) - kSadTabOffset;
|
||||
|
||||
|
||||
NSSize titleSize = [titleString size];
|
||||
CGFloat titleX = (viewBounds.size.width - titleSize.width) / 2;
|
||||
CGFloat titleY = iconY - kIconTitleSpacing - titleSize.height;
|
||||
@@ -63,11 +63,11 @@ static const int kTitleMessageSpacing = 15;
|
||||
NSSize messageSize = [messageString size];
|
||||
CGFloat messageX = (viewBounds.size.width - messageSize.width) / 2;
|
||||
CGFloat messageY = titleY - kTitleMessageSpacing - messageSize.height;
|
||||
|
||||
|
||||
// Paint
|
||||
[backgroundColor set];
|
||||
NSRectFill(viewBounds);
|
||||
|
||||
|
||||
[sadTabImage drawAtPoint:NSMakePoint(iconX, iconY)
|
||||
fromRect:NSZeroRect
|
||||
operation:NSCompositeSourceOver
|
||||
|
||||
@@ -46,7 +46,7 @@ class ToolbarModel;
|
||||
// Create the contents of a tab represented by |contents| and loaded from the
|
||||
// nib given by |name|. |commands| allows tracking of what's enabled and
|
||||
// disabled. It may be nil if no updating is desired.
|
||||
- (id)initWithNibName:(NSString*)name
|
||||
- (id)initWithNibName:(NSString*)name
|
||||
bundle:(NSBundle*)bundle
|
||||
contents:(TabContents*)contents
|
||||
commands:(CommandUpdater*)commands
|
||||
|
||||
@@ -58,7 +58,7 @@ class LocationBarBridge : public LocationBar {
|
||||
virtual std::wstring GetInputString() const;
|
||||
virtual WindowOpenDisposition GetWindowOpenDisposition() const
|
||||
{ NOTIMPLEMENTED(); return CURRENT_TAB; }
|
||||
virtual PageTransition::Type GetPageTransition() const
|
||||
virtual PageTransition::Type GetPageTransition() const
|
||||
{ NOTIMPLEMENTED(); return 0; }
|
||||
virtual void AcceptInput() { NOTIMPLEMENTED(); }
|
||||
virtual void FocusLocation();
|
||||
@@ -71,7 +71,7 @@ class LocationBarBridge : public LocationBar {
|
||||
|
||||
@implementation TabContentsController
|
||||
|
||||
- (id)initWithNibName:(NSString*)name
|
||||
- (id)initWithNibName:(NSString*)name
|
||||
bundle:(NSBundle*)bundle
|
||||
contents:(TabContents*)contents
|
||||
commands:(CommandUpdater*)commands
|
||||
@@ -97,7 +97,7 @@ class LocationBarBridge : public LocationBar {
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[contentsBox_ setContentView:contents_->GetNativeView()];
|
||||
|
||||
|
||||
// Provide a starting point since we won't get notifications if the state
|
||||
// doesn't change between tabs.
|
||||
[self updateToolbarCommandStatus];
|
||||
@@ -185,7 +185,7 @@ class LocationBarBridge : public LocationBar {
|
||||
- (void)updateToolbarWithContents:(TabContents*)tab {
|
||||
// TODO(pinkerton): there's a lot of ui code in autocomplete_edit.cc
|
||||
// that we'll want to duplicate. For now, just handle setting the text.
|
||||
|
||||
|
||||
// TODO(pinkerton): update the security lock icon and background color
|
||||
|
||||
NSString* urlString = base::SysWideToNSString(toolbarModel_->GetText());
|
||||
@@ -217,8 +217,8 @@ class LocationBarBridge : public LocationBar {
|
||||
localGrowBox = [contentView convertRect:localGrowBox
|
||||
fromView:[self view]];
|
||||
// Flip the rect in view coordinates
|
||||
localGrowBox.origin.y =
|
||||
[contentView frame].size.height - localGrowBox.origin.y -
|
||||
localGrowBox.origin.y =
|
||||
[contentView frame].size.height - localGrowBox.origin.y -
|
||||
localGrowBox.size.height;
|
||||
}
|
||||
return localGrowBox;
|
||||
@@ -252,9 +252,9 @@ TabContentsCommandObserver::~TabContentsCommandObserver() {
|
||||
commands_->RemoveCommandObserver(this);
|
||||
}
|
||||
|
||||
void TabContentsCommandObserver::EnabledStateChangedForCommand(int command,
|
||||
void TabContentsCommandObserver::EnabledStateChangedForCommand(int command,
|
||||
bool enabled) {
|
||||
[controller_ enabledStateChangedForCommand:command
|
||||
[controller_ enabledStateChangedForCommand:command
|
||||
enabled:enabled ? YES : NO];
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class ToolbarModel;
|
||||
// Initialize the controller with a view, model, and command updater for
|
||||
// tracking what's enabled and disabled. |commands| may be nil if no updating
|
||||
// is desired.
|
||||
- (id)initWithView:(TabStripView*)view
|
||||
- (id)initWithView:(TabStripView*)view
|
||||
tabModel:(TabStripModel*)tabModel
|
||||
toolbarModel:(ToolbarModel*)toolbarModel
|
||||
commands:(CommandUpdater*)commands;
|
||||
|
||||
@@ -20,13 +20,13 @@ const short kTabOverlap = 16;
|
||||
- (void)insertTabWithContents:(TabContents*)contents
|
||||
atIndex:(NSInteger)index
|
||||
inForeground:(bool)inForeground;
|
||||
- (void)selectTabWithContents:(TabContents*)newContents
|
||||
- (void)selectTabWithContents:(TabContents*)newContents
|
||||
previousContents:(TabContents*)oldContents
|
||||
atIndex:(NSInteger)index
|
||||
userGesture:(bool)wasUserGesture;
|
||||
- (void)tabDetachedWithContents:(TabContents*)contents
|
||||
atIndex:(NSInteger)index;
|
||||
- (void)tabChangedWithContents:(TabContents*)contents
|
||||
- (void)tabChangedWithContents:(TabContents*)contents
|
||||
atIndex:(NSInteger)index;
|
||||
@end
|
||||
|
||||
@@ -60,7 +60,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
|
||||
@implementation TabStripController
|
||||
|
||||
- (id)initWithView:(TabStripView*)view
|
||||
- (id)initWithView:(TabStripView*)view
|
||||
tabModel:(TabStripModel*)tabModel
|
||||
toolbarModel:(ToolbarModel*)toolbarModel
|
||||
commands:(CommandUpdater*)commands {
|
||||
@@ -72,7 +72,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
commands_ = commands;
|
||||
bridge_ = new TabStripBridge(tabModel, self);
|
||||
tabControllerArray_ = [[NSMutableArray alloc] init];
|
||||
|
||||
|
||||
// Create the new tab button separate from the nib so we can make sure
|
||||
// it's always at the end of the subview list.
|
||||
NSImage* image = [NSImage imageNamed:@"newtab"];
|
||||
@@ -100,7 +100,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
// out the sole child of the contentArea to display its contents.
|
||||
- (void)swapInTabAtIndex:(NSInteger)index {
|
||||
TabContentsController* controller = [tabControllerArray_ objectAtIndex:index];
|
||||
|
||||
|
||||
// Resize the new view to fit the window
|
||||
NSView* contentView = [[tabView_ window] contentView];
|
||||
NSView* newView = [controller view];
|
||||
@@ -132,7 +132,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
[button setBezelStyle:NSRegularSquareBezelStyle];
|
||||
[button setTarget:self];
|
||||
[button setAction:@selector(selectTab:)];
|
||||
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
@@ -162,13 +162,13 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
tabModel_->SelectTabContentsAt(index, true);
|
||||
}
|
||||
|
||||
// Return the frame for a new tab that will go to the immediate right of the
|
||||
// Return the frame for a new tab that will go to the immediate right of the
|
||||
// tab at |index|. If |index| is 0, this will be the first tab, indented so
|
||||
// as to not cover the window controls.
|
||||
- (NSRect)frameForNewTabAtIndex:(NSInteger)index {
|
||||
const short kIndentLeavingSpaceForControls = 66;
|
||||
const short kNewTabWidth = 160;
|
||||
|
||||
|
||||
short xOffset = kIndentLeavingSpaceForControls;
|
||||
if (index > 0) {
|
||||
NSRect previousTab = [[[tabView_ subviews] objectAtIndex:index - 1] frame];
|
||||
@@ -196,43 +196,43 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
inForeground:(bool)inForeground {
|
||||
DCHECK(contents);
|
||||
DCHECK(index == TabStripModel::kNoTab || tabModel_->ContainsIndex(index));
|
||||
|
||||
|
||||
// TODO(pinkerton): handle tab dragging in here
|
||||
|
||||
// Make a new tab. Load the contents of this tab from the nib and associate
|
||||
// the new controller with |contents| so it can be looked up later.
|
||||
TabContentsController* contentsController =
|
||||
[[[TabContentsController alloc] initWithNibName:@"TabContents"
|
||||
[[[TabContentsController alloc] initWithNibName:@"TabContents"
|
||||
bundle:nil
|
||||
contents:contents
|
||||
commands:commands_
|
||||
toolbarModel:toolbarModel_]
|
||||
autorelease];
|
||||
[tabControllerArray_ insertObject:contentsController atIndex:index];
|
||||
|
||||
|
||||
// Remove the new tab button so the only views present are the tabs,
|
||||
// we'll add it back when we're done
|
||||
[newTabButton_ removeFromSuperview];
|
||||
|
||||
|
||||
// Make a new tab view and add it to the strip.
|
||||
// TODO(pinkerton): move everyone else over and animate. Also will need to
|
||||
// move the "add tab" button over.
|
||||
NSRect newTabFrame = [self frameForNewTabAtIndex:index];
|
||||
NSButton* newView = [self newTabWithFrame:newTabFrame];
|
||||
[tabView_ addSubview:newView];
|
||||
|
||||
|
||||
[self setTabTitle:newView withContents:contents];
|
||||
|
||||
|
||||
// Add the new tab button back in to the right of the last tab.
|
||||
const NSInteger kNewTabXOffset = 10;
|
||||
NSRect lastTab =
|
||||
NSRect lastTab =
|
||||
[[[tabView_ subviews] objectAtIndex:[[tabView_ subviews] count] - 1] frame];
|
||||
NSInteger maxRightEdge = NSMaxX(lastTab);
|
||||
NSRect newTabButtonFrame = [newTabButton_ frame];
|
||||
newTabButtonFrame.origin.x = maxRightEdge + kNewTabXOffset;
|
||||
[newTabButton_ setFrame:newTabButtonFrame];
|
||||
[tabView_ addSubview:newTabButton_];
|
||||
|
||||
|
||||
// Select the newly created tab if in the foreground
|
||||
if (inForeground)
|
||||
[self swapInTabAtIndex:index];
|
||||
@@ -240,7 +240,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
|
||||
// Called when a notification is received from the model to select a particular
|
||||
// tab. Swaps in the toolbar and content area associated with |newContents|.
|
||||
- (void)selectTabWithContents:(TabContents*)newContents
|
||||
- (void)selectTabWithContents:(TabContents*)newContents
|
||||
previousContents:(TabContents*)oldContents
|
||||
atIndex:(NSInteger)index
|
||||
userGesture:(bool)wasUserGesture {
|
||||
@@ -250,7 +250,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
NSButton* current = [[tabView_ subviews] objectAtIndex:i];
|
||||
[current setState:(i == index) ? NSOnState : NSOffState];
|
||||
}
|
||||
|
||||
|
||||
// Tell the new tab contents it is about to become the selected tab. Here it
|
||||
// can do things like make sure the toolbar is up to date.
|
||||
TabContentsController* newController =
|
||||
@@ -262,7 +262,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
}
|
||||
|
||||
// Called when a notification is received from the model that the given tab
|
||||
// has gone away. Remove all knowledge about this tab and it's associated
|
||||
// has gone away. Remove all knowledge about this tab and it's associated
|
||||
// controller and remove the view from the strip.
|
||||
- (void)tabDetachedWithContents:(TabContents*)contents
|
||||
atIndex:(NSInteger)index {
|
||||
@@ -276,7 +276,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
NSView* tab = [[tabView_ subviews] objectAtIndex:index];
|
||||
NSInteger tabWidth = [tab frame].size.width;
|
||||
[tab removeFromSuperview];
|
||||
|
||||
|
||||
// Move all the views to the right the width of the tab that was closed.
|
||||
// TODO(pinkerton): Animate!
|
||||
const int numSubviews = [[tabView_ subviews] count];
|
||||
@@ -290,11 +290,11 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
|
||||
// Called when a notification is received from the model that the given tab
|
||||
// has been updated.
|
||||
- (void)tabChangedWithContents:(TabContents*)contents
|
||||
- (void)tabChangedWithContents:(TabContents*)contents
|
||||
atIndex:(NSInteger)index {
|
||||
NSButton* tab = [[tabView_ subviews] objectAtIndex:index];
|
||||
[self setTabTitle:tab withContents:contents];
|
||||
|
||||
|
||||
TabContentsController* updatedController =
|
||||
[tabControllerArray_ objectAtIndex:index];
|
||||
[updatedController tabDidChange:contents];
|
||||
@@ -309,13 +309,13 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
- (void)updateToolbarWithContents:(TabContents*)tab
|
||||
shouldRestoreState:(BOOL)shouldRestore {
|
||||
// TODO(pinkerton): OS_WIN maintains this, but I'm not sure why. It's
|
||||
// available by querying the model, which we have available to us.
|
||||
// available by querying the model, which we have available to us.
|
||||
currentTab_ = tab;
|
||||
|
||||
|
||||
// tell the appropriate controller to update its state. |shouldRestore| being
|
||||
// YES means we're going back to this tab and should put back any state
|
||||
// associated with it.
|
||||
TabContentsController* controller =
|
||||
TabContentsController* controller =
|
||||
[tabControllerArray_ objectAtIndex:tabModel_->GetIndexOfTabContents(tab)];
|
||||
[controller updateToolbarWithContents:shouldRestore ? tab : nil];
|
||||
}
|
||||
@@ -364,7 +364,7 @@ class TabStripBridge : public TabStripModelObserver {
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
TabStripBridge::TabStripBridge(TabStripModel* model,
|
||||
TabStripBridge::TabStripBridge(TabStripModel* model,
|
||||
TabStripController* controller)
|
||||
: controller_(controller), model_(model) {
|
||||
// Register to be a listener on the model so we can get updates and tell
|
||||
@@ -380,8 +380,8 @@ TabStripBridge::~TabStripBridge() {
|
||||
void TabStripBridge::TabInsertedAt(TabContents* contents,
|
||||
int index,
|
||||
bool foreground) {
|
||||
[controller_ insertTabWithContents:contents
|
||||
atIndex:index
|
||||
[controller_ insertTabWithContents:contents
|
||||
atIndex:index
|
||||
inForeground:foreground];
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ void TabStripBridge::TabSelectedAt(TabContents* old_contents,
|
||||
TabContents* new_contents,
|
||||
int index,
|
||||
bool user_gesture) {
|
||||
[controller_ selectTabWithContents:new_contents
|
||||
[controller_ selectTabWithContents:new_contents
|
||||
previousContents:old_contents
|
||||
atIndex:index
|
||||
userGesture:user_gesture];
|
||||
|
||||
@@ -61,7 +61,7 @@ class CommandUpdater {
|
||||
|
||||
// Removes an observer to the state of a particular command.
|
||||
void RemoveCommandObserver(int id, CommandObserver* observer);
|
||||
|
||||
|
||||
// Removes |observer| for all commands on which it's registered.
|
||||
void RemoveCommandObserver(CommandObserver* observer);
|
||||
|
||||
|
||||
@@ -79,12 +79,12 @@ TEST_F(CommandUpdaterTest, TestObservers) {
|
||||
TEST_F(CommandUpdaterTest, TestObserverRemovingAllCommands) {
|
||||
TestingCommandHandlerMock handler;
|
||||
CommandUpdater command_updater(&handler);
|
||||
|
||||
|
||||
// Create two observers for the commands 1-3 as true, remove one using the
|
||||
// single remove command, then set the command to false. Ensure that the
|
||||
// removed observer still thinks all commands are true and the one left
|
||||
// observing picked up the change.
|
||||
|
||||
|
||||
TestingCommandObserverMock observer_remove, observer_keep;
|
||||
command_updater.AddCommandObserver(1, &observer_remove);
|
||||
command_updater.AddCommandObserver(2, &observer_remove);
|
||||
|
||||
@@ -137,7 +137,7 @@ void DebuggerContents::Init() {
|
||||
|
||||
// static
|
||||
bool DebuggerContents::IsDebuggerUrl(const GURL& url) {
|
||||
return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) &&
|
||||
return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) &&
|
||||
url.host() == kDebuggerHost);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class DebuggerHost : public base::RefCountedThreadSafe<DebuggerHost> {
|
||||
virtual void OnDebugAttach() = 0;
|
||||
// The renderer we're attached to is gone.
|
||||
virtual void OnDebugDisconnect() = 0;
|
||||
|
||||
|
||||
virtual void DidDisconnect() = 0;
|
||||
virtual void DidConnect() {}
|
||||
virtual void ProcessCommand(const std::wstring& data) {}
|
||||
|
||||
@@ -66,7 +66,7 @@ class TabContentsReference : public NotificationObserver {
|
||||
|
||||
|
||||
DebuggerHostImpl::DebuggerHostImpl(DebuggerInputOutput* io)
|
||||
: io_(io),
|
||||
: io_(io),
|
||||
debugger_ready_(true) {
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ DebuggerHostImpl::~DebuggerHostImpl() {
|
||||
io_ = NULL;
|
||||
}
|
||||
|
||||
void DebuggerHostImpl::Start() {
|
||||
io_->Start(this);
|
||||
void DebuggerHostImpl::Start() {
|
||||
io_->Start(this);
|
||||
}
|
||||
|
||||
void DebuggerHostImpl::Debug(TabContents* tab) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
virtual void SetDebuggerBreak(bool brk) {}
|
||||
|
||||
// sends message to debugger UI page in order to invoke JS function in it
|
||||
virtual void CallFunctionInPage(const std::wstring& name,
|
||||
virtual void CallFunctionInPage(const std::wstring& name,
|
||||
ListValue* argv) {}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -126,7 +126,7 @@ void DebuggerWindow::SetDebuggerBreak(bool brk) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void DebuggerWindow::CallFunctionInPage(const std::wstring& name,
|
||||
void DebuggerWindow::CallFunctionInPage(const std::wstring& name,
|
||||
ListValue* argv) {
|
||||
if (view_) {
|
||||
DictionaryValue* body = new DictionaryValue;
|
||||
|
||||
@@ -37,7 +37,7 @@ class DebuggerWindow : public DebuggerInputOutput,
|
||||
virtual void SetDebuggerBreak(bool brk);
|
||||
|
||||
// Note that this method will take ownership of argv.
|
||||
virtual void CallFunctionInPage(const std::wstring& name,
|
||||
virtual void CallFunctionInPage(const std::wstring& name,
|
||||
ListValue* argv);
|
||||
|
||||
// views::WindowDelegate methods:
|
||||
|
||||
@@ -360,7 +360,7 @@ DockInfo DockInfo::GetDockInfoAtPoint(const gfx::Point& screen_point,
|
||||
int mid_x = (m_bounds.left + m_bounds.right) / 2;
|
||||
int mid_y = (m_bounds.top + m_bounds.bottom) / 2;
|
||||
|
||||
bool result =
|
||||
bool result =
|
||||
info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.top,
|
||||
DockInfo::MAXIMIZE) ||
|
||||
info.CheckMonitorPoint(monitor, screen_point, mid_x, m_bounds.bottom,
|
||||
|
||||
@@ -105,7 +105,7 @@ void RegisterURLRequestChromeJob() {
|
||||
#ifdef CHROME_PERSONALIZATION
|
||||
url_util::AddStandardScheme(kPersonalizationScheme);
|
||||
URLRequest::RegisterProtocolFactory(kPersonalizationScheme,
|
||||
&ChromeURLDataManager::Factory);
|
||||
&ChromeURLDataManager::Factory);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ DOMUI::~DOMUI() {
|
||||
void DOMUI::ProcessDOMUIMessage(const std::string& message,
|
||||
const std::string& content) {
|
||||
// Look up the callback for this message.
|
||||
MessageCallbackMap::const_iterator callback =
|
||||
MessageCallbackMap::const_iterator callback =
|
||||
message_callbacks_.find(message);
|
||||
if (callback == message_callbacks_.end())
|
||||
return;
|
||||
@@ -74,7 +74,7 @@ void DOMUI::CallJavascriptFunction(
|
||||
ExecuteJavascript(javascript);
|
||||
}
|
||||
|
||||
void DOMUI::RegisterMessageCallback(const std::string &message,
|
||||
void DOMUI::RegisterMessageCallback(const std::string &message,
|
||||
MessageCallback *callback) {
|
||||
message_callbacks_.insert(std::make_pair(message, callback));
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void DOMUI::AddMessageHandler(DOMMessageHandler* handler) {
|
||||
|
||||
void DOMUI::ExecuteJavascript(const std::wstring& javascript) {
|
||||
DCHECK(contents_);
|
||||
contents_->render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(),
|
||||
contents_->render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(),
|
||||
javascript);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ DOMMessageHandler::DOMMessageHandler(DOMUI *dom_ui) : dom_ui_(dom_ui) {
|
||||
|
||||
// DOMMessageHandler, protected: ----------------------------------------------
|
||||
|
||||
void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
|
||||
void DOMMessageHandler::SetURLAndTitle(DictionaryValue* dictionary,
|
||||
std::wstring title,
|
||||
const GURL& gurl) {
|
||||
std::wstring wstring_url = UTF8ToWide(gurl.spec());
|
||||
|
||||
@@ -91,7 +91,7 @@ class DOMMessageHandler {
|
||||
protected:
|
||||
// Adds "url" and "title" keys on incoming dictionary, setting title
|
||||
// as the url as a fallback on empty title.
|
||||
static void SetURLAndTitle(DictionaryValue* dictionary,
|
||||
static void SetURLAndTitle(DictionaryValue* dictionary,
|
||||
std::wstring title,
|
||||
const GURL& gurl);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class DOMUIContents : public WebContents {
|
||||
|
||||
//
|
||||
// TabContents overrides
|
||||
//
|
||||
//
|
||||
virtual void UpdateHistoryForNavigation(const GURL& url,
|
||||
const ViewHostMsg_FrameNavigate_Params& params) { }
|
||||
virtual bool NavigateToPendingEntry(bool reload);
|
||||
|
||||
@@ -41,7 +41,7 @@ void FileIconSource::StartDataRequest(const std::string& path,
|
||||
SendResponse(request_id, icon_data);
|
||||
} else {
|
||||
// Icon was not in cache, go fetch it slowly.
|
||||
IconManager::Handle h = im->LoadIcon(UTF8ToWide(escaped_path),
|
||||
IconManager::Handle h = im->LoadIcon(UTF8ToWide(escaped_path),
|
||||
IconLoader::NORMAL,
|
||||
&cancelable_consumer_,
|
||||
NewCallback(this, &FileIconSource::OnFileIconDataAvailable));
|
||||
@@ -66,4 +66,4 @@ void FileIconSource::OnFileIconDataAvailable(IconManager::Handle handle,
|
||||
// TODO(glen): send a dummy icon.
|
||||
SendResponse(request_id, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void BrowsingHistoryHandler::HandleDeleteDay(const Value* value) {
|
||||
dom_ui_->CallJavascriptFunction(L"deleteFailed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Anything in-flight is invalid.
|
||||
cancelable_consumer_.CancelAllRequests();
|
||||
|
||||
@@ -254,7 +254,7 @@ void BrowsingHistoryHandler::QueryComplete(
|
||||
base::TimeFormatShortDate(page.visit_time()));
|
||||
page_value->SetString(L"snippet", page.snippet().text());
|
||||
}
|
||||
page_value->SetBoolean(L"starred",
|
||||
page_value->SetBoolean(L"starred",
|
||||
dom_ui_->get_profile()->GetBookmarkModel()->IsBookmarked(page.url()));
|
||||
results_value.Append(page_value);
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class BrowsingHistoryHandler : public DOMMessageHandler,
|
||||
history::QueryResults* results);
|
||||
|
||||
// Extract the arguments from the call to HandleSearchHistory.
|
||||
void ExtractSearchHistoryArguments(const Value* value,
|
||||
int* month,
|
||||
void ExtractSearchHistoryArguments(const Value* value,
|
||||
int* month,
|
||||
std::wstring* query);
|
||||
|
||||
// Figure out the query options for a month-wide query.
|
||||
@@ -72,7 +72,7 @@ class BrowsingHistoryHandler : public DOMMessageHandler,
|
||||
|
||||
// Browsing history remover
|
||||
scoped_ptr<BrowsingDataRemover> remover_;
|
||||
|
||||
|
||||
// Our consumer for the history service.
|
||||
CancelableRequestConsumerTSimple<PageUsageData*> cancelable_consumer_;
|
||||
|
||||
|
||||
@@ -228,8 +228,8 @@ class HistoryHandler : public DOMMessageHandler {
|
||||
|
||||
// Let the page contents record UMA actions. Only use when you can't do it from
|
||||
// C++. For example, we currently use it to let the NTP log the postion of the
|
||||
// Most Visited or Bookmark the user clicked on, as we don't get that
|
||||
// information through RequestOpenURL. You will need to update the metrics
|
||||
// Most Visited or Bookmark the user clicked on, as we don't get that
|
||||
// information through RequestOpenURL. You will need to update the metrics
|
||||
// dashboard with the action names you use, as our processor won't catch that
|
||||
// information (treat it as RecordComputedMetrics)
|
||||
class MetricsHandler : public DOMMessageHandler {
|
||||
|
||||
@@ -378,7 +378,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
|
||||
return FilePath::FromWStringHack(*download_path_);
|
||||
}
|
||||
|
||||
// Clears the last download path, used to initialize "save as" dialogs.
|
||||
// Clears the last download path, used to initialize "save as" dialogs.
|
||||
void ClearLastDownloadPath();
|
||||
|
||||
// Registers this file extension for automatic opening upon download
|
||||
@@ -480,7 +480,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
|
||||
// Renames a finished dangerous download from its temporary file name to its
|
||||
// real file name.
|
||||
// Invoked on the file thread.
|
||||
void ProceedWithFinishedDangerousDownload(int64 download_handle,
|
||||
void ProceedWithFinishedDangerousDownload(int64 download_handle,
|
||||
const FilePath& path,
|
||||
const FilePath& original_name);
|
||||
|
||||
@@ -512,7 +512,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>,
|
||||
// is the ID assigned by the ResourceDispatcherHost and the map does not own
|
||||
// the DownloadItems. It is used on shutdown to delete completed downloads
|
||||
// that have not been approved.
|
||||
//
|
||||
//
|
||||
// When a download is created through a user action, the corresponding
|
||||
// DownloadItem* is placed in 'in_progress_' and remains there until it has
|
||||
// received a valid handle from the history system. Once it has a valid
|
||||
|
||||
@@ -1051,7 +1051,7 @@ bool SavePackage::GetSaveInfo(const FilePath& suggest_name,
|
||||
if (param->save_type == SavePackage::SAVE_AS_COMPLETE_HTML) {
|
||||
// Make new directory for saving complete file.
|
||||
param->dir = param->dir.Append(
|
||||
param->saved_main_file_path.RemoveExtension().BaseName().value() +
|
||||
param->saved_main_file_path.RemoveExtension().BaseName().value() +
|
||||
FILE_PATH_LITERAL("_files"));
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ DictionaryValue* ExtensionsServiceBackend::ReadManifest(
|
||||
}
|
||||
if (header.header_size > sizeof(ExtensionHeader))
|
||||
fseek(file.get(), header.header_size - sizeof(ExtensionHeader), SEEK_CUR);
|
||||
|
||||
|
||||
char buf[1 << 16];
|
||||
std::string manifest_str;
|
||||
size_t read_size = std::min(sizeof(buf), header.manifest_size);
|
||||
@@ -495,7 +495,7 @@ bool ExtensionsServiceBackend::CheckCurrentVersion(
|
||||
// has actually loaded successfully.
|
||||
FilePath version_dir = dest_dir.AppendASCII(current_version_str);
|
||||
if (file_util::PathExists(version_dir)) {
|
||||
ReportExtensionInstallError(dest_dir,
|
||||
ReportExtensionInstallError(dest_dir,
|
||||
"Existing version is already up to date.");
|
||||
return false;
|
||||
}
|
||||
@@ -503,7 +503,7 @@ bool ExtensionsServiceBackend::CheckCurrentVersion(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExtensionsServiceBackend::InstallDirSafely(const FilePath& source_dir,
|
||||
bool ExtensionsServiceBackend::InstallDirSafely(const FilePath& source_dir,
|
||||
const FilePath& dest_dir) {
|
||||
|
||||
if (file_util::PathExists(dest_dir)) {
|
||||
@@ -564,13 +564,13 @@ bool ExtensionsServiceBackend::SetCurrentVersion(const FilePath& dest_dir,
|
||||
// Restore the old CurrentVersion.
|
||||
if (file_util::PathExists(current_version_old)) {
|
||||
if (!file_util::Move(current_version_old, current_version)) {
|
||||
LOG(WARNING) << "couldn't restore " << current_version_old.value() <<
|
||||
LOG(WARNING) << "couldn't restore " << current_version_old.value() <<
|
||||
" to " << current_version.value();
|
||||
|
||||
// TODO(erikkay): This is an ugly state to be in. Try harder?
|
||||
}
|
||||
}
|
||||
ReportExtensionInstallError(dest_dir,
|
||||
ReportExtensionInstallError(dest_dir,
|
||||
"Couldn't create CurrentVersion file.");
|
||||
return false;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ bool ExtensionsServiceBackend::InstallOrUpdateExtension(
|
||||
|
||||
// If an expected id was provided, make sure it matches.
|
||||
if (expected_id.length() && expected_id != extension.id()) {
|
||||
ReportExtensionInstallError(source_file,
|
||||
ReportExtensionInstallError(source_file,
|
||||
"ID in new extension manifest does not match expected ID.");
|
||||
return false;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ bool ExtensionsServiceBackend::InstallOrUpdateExtension(
|
||||
ScopedTempDir scoped_temp;
|
||||
scoped_temp.Set(temp_dir);
|
||||
if (!scoped_temp.IsValid()) {
|
||||
ReportExtensionInstallError(source_file,
|
||||
ReportExtensionInstallError(source_file,
|
||||
"Couldn't create temporary directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class ExtensionsServiceBackend
|
||||
scoped_refptr<ExtensionsServiceFrontendInterface> frontend);
|
||||
|
||||
// Check externally updated extensions for updates and install if necessary.
|
||||
// Errors are reported through ExtensionErrorReporter.
|
||||
// Errors are reported through ExtensionErrorReporter.
|
||||
// ReportExtensionInstalled is called on success.
|
||||
void CheckForExternalUpdates(
|
||||
scoped_refptr<ExtensionsServiceFrontendInterface> frontend);
|
||||
|
||||
@@ -155,7 +155,7 @@ base::SharedMemory* UserScriptMaster::ScriptReloader::GetNewScripts(
|
||||
file = enumerator.Next()) {
|
||||
all_scripts.push_back(UserScript());
|
||||
UserScript& info = all_scripts.back();
|
||||
info.set_url(GURL(std::string(chrome::kUserScriptScheme) + ":/" +
|
||||
info.set_url(GURL(std::string(chrome::kUserScriptScheme) + ":/" +
|
||||
net::FilePathToFileURL(file.ToWStringHack()).ExtractFileName()));
|
||||
info.set_path(file);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void ExternalTabContainer::Observe(NotificationType type,
|
||||
const NavigationController::LoadCommittedDetails* commit =
|
||||
Details<NavigationController::LoadCommittedDetails>(details).ptr();
|
||||
|
||||
if (commit->http_status_code >= kHttpClientErrorStart &&
|
||||
if (commit->http_status_code >= kHttpClientErrorStart &&
|
||||
commit->http_status_code <= kHttpServerErrorEnd) {
|
||||
automation_->Send(new AutomationMsg_NavigationFailed(
|
||||
0, commit->http_status_code, commit->entry->url()));
|
||||
|
||||
@@ -83,7 +83,7 @@ bool GetBackupChromeFile(std::wstring* path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring GetDefaultPrefFilePath(bool create_profile_dir,
|
||||
std::wstring GetDefaultPrefFilePath(bool create_profile_dir,
|
||||
const std::wstring& user_data_dir) {
|
||||
FilePath default_pref_dir = ProfileManager::GetDefaultProfileDir(
|
||||
FilePath::FromWStringHack(user_data_dir));
|
||||
@@ -218,7 +218,7 @@ bool FirstRun::ProcessMasterPreferences(
|
||||
// result determines if we continue or not. We wait here until the user
|
||||
// dismisses the dialog.
|
||||
int retcode = 0;
|
||||
if (!LaunchSetupWithParam(installer_util::switches::kShowEula, &retcode) ||
|
||||
if (!LaunchSetupWithParam(installer_util::switches::kShowEula, &retcode) ||
|
||||
(retcode == installer_util::EULA_REJECTED)) {
|
||||
LOG(WARNING) << "EULA rejected. Fast exit.";
|
||||
::ExitProcess(1);
|
||||
@@ -457,7 +457,7 @@ class FirstRunImportObserver : public ImportObserver {
|
||||
import_result_ = ResultCodes::NORMAL_EXIT;
|
||||
Finish();
|
||||
}
|
||||
|
||||
|
||||
void RunLoop() {
|
||||
loop_running_ = true;
|
||||
MessageLoop::current()->Run();
|
||||
|
||||
@@ -134,7 +134,7 @@ static GURL ConvertSkBitmapToDataURL(const SkBitmap& icon) {
|
||||
class CreateShortcutCommand : public CPCommandInterface {
|
||||
public:
|
||||
CreateShortcutCommand(
|
||||
const std::string& name, const std::string& orig_name,
|
||||
const std::string& name, const std::string& orig_name,
|
||||
const std::string& url, const std::string& description,
|
||||
const std::vector<webkit_glue::WebApplicationInfo::IconInfo> &icons,
|
||||
const SkBitmap& fallback_icon,
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CanUpdateCurrentChrome(const std::wstring& chrome_exe_path) {
|
||||
user_exe_path.begin(), tolower);
|
||||
std::transform(machine_exe_path.begin(), machine_exe_path.end(),
|
||||
machine_exe_path.begin(), tolower);
|
||||
if (chrome_exe_path != user_exe_path &&
|
||||
if (chrome_exe_path != user_exe_path &&
|
||||
chrome_exe_path != machine_exe_path ) {
|
||||
LOG(ERROR) << L"Google Update cannot update Chrome installed in a "
|
||||
<< L"non-standard location: " << chrome_exe_path.c_str()
|
||||
|
||||
@@ -291,7 +291,7 @@ void QueryParser::ExtractQueryWords(const std::wstring& query,
|
||||
QueryNodeList root;
|
||||
if (!ParseQueryImpl(query, &root))
|
||||
return;
|
||||
root.AppendWords(words);
|
||||
root.AppendWords(words);
|
||||
}
|
||||
|
||||
bool QueryParser::DoesQueryMatch(const std::wstring& text,
|
||||
|
||||
@@ -230,7 +230,7 @@ void TextDatabaseManager::AddPageContents(const GURL& url,
|
||||
// took more than kExpirationSec to load. Often, this will be the result of
|
||||
// a very slow iframe or other resource on the page that makes us think its
|
||||
// still loading.
|
||||
//
|
||||
//
|
||||
// As a fallback, set the most recent visit's contents using the input, and
|
||||
// use the last set title in the URL table as the title to index.
|
||||
URLRow url_row;
|
||||
|
||||
@@ -28,7 +28,7 @@ bool IsURLRowEqual(const URLRow& a,
|
||||
a.last_visit() - b.last_visit() <= TimeDelta::FromSeconds(1) &&
|
||||
a.hidden() == b.hidden();
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
class URLDatabaseTest : public testing::Test,
|
||||
|
||||
@@ -140,7 +140,7 @@ void Firefox2Importer::ImportBookmarksFile(
|
||||
file_util::ReadFileToString(file_path, &content);
|
||||
std::vector<std::string> lines;
|
||||
SplitString(content, '\n', &lines);
|
||||
|
||||
|
||||
std::vector<ProfileWriter::BookmarkEntry> toolbar_bookmarks;
|
||||
std::wstring last_folder = first_folder_name;
|
||||
bool last_folder_on_toolbar = false;
|
||||
|
||||
@@ -106,7 +106,7 @@ class ProfileWriter : public base::RefCounted<ProfileWriter> {
|
||||
#endif
|
||||
virtual void AddHistoryPage(const std::vector<history::URLRow>& page);
|
||||
virtual void AddHomepage(const GURL& homepage);
|
||||
// Adds the bookmarks to the BookmarkModel.
|
||||
// Adds the bookmarks to the BookmarkModel.
|
||||
// |options| is a bitmask of BookmarkOptions and dictates how and
|
||||
// which bookmarks are added. If the bitmask contains FIRST_RUN,
|
||||
// then any entries with a value of true for in_toolbar are added to
|
||||
@@ -385,7 +385,7 @@ class Importer : public base::RefCounted<Importer> {
|
||||
// The importer should know the main thread so that ProfileWriter
|
||||
// will be invoked in thread instead.
|
||||
MessageLoop* main_loop_;
|
||||
|
||||
|
||||
// The message loop in which the importer operates.
|
||||
MessageLoop* delagate_loop_;
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) {
|
||||
contents->CompleteNavigationAsRenderer(0, kExistingURL1);
|
||||
EXPECT_TRUE(notifications.Check1AndReset(
|
||||
NotificationType::NAV_ENTRY_COMMITTED));
|
||||
|
||||
|
||||
// Do a new navigation without making a pending one.
|
||||
const GURL kNewURL(scheme1() + ":see");
|
||||
contents->CompleteNavigationAsRenderer(99, kNewURL);
|
||||
@@ -708,7 +708,7 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) {
|
||||
// Not synthesize a totally new back event to the first page. This will not
|
||||
// match the pending one.
|
||||
contents->CompleteNavigationAsRenderer(0, kUrl1);
|
||||
|
||||
|
||||
// The navigation should not have affected the pending entry.
|
||||
EXPECT_EQ(1, contents->controller()->GetPendingEntryIndex());
|
||||
|
||||
@@ -1172,7 +1172,7 @@ TEST_F(NavigationControllerTest, SwitchTypesCleanup) {
|
||||
// Now that the tasks have been flushed, the first tab type should be gone.
|
||||
ASSERT_TRUE(
|
||||
contents->controller()->GetTabContents(type1()) == NULL);
|
||||
ASSERT_EQ(contents,
|
||||
ASSERT_EQ(contents,
|
||||
contents->controller()->GetTabContents(type2()));
|
||||
}
|
||||
|
||||
@@ -1444,7 +1444,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
|
||||
// We should have navigated, transient entry should be gone.
|
||||
EXPECT_EQ(url2, contents->controller()->GetActiveEntry()->url());
|
||||
EXPECT_EQ(contents->controller()->GetEntryCount(), 3);
|
||||
|
||||
|
||||
// Add a transient again, then navigate with no pending entry this time.
|
||||
transient_entry = new NavigationEntry(TAB_CONTENTS_WEB);
|
||||
transient_entry->set_url(transient_url);
|
||||
@@ -1477,7 +1477,7 @@ TEST_F(NavigationControllerTest, TransientEntry) {
|
||||
EXPECT_EQ(url4, contents->controller()->GetActiveEntry()->url());
|
||||
EXPECT_EQ(contents->controller()->GetEntryCount(), 5);
|
||||
contents->CompleteNavigationAsRenderer(3, url3);
|
||||
|
||||
|
||||
// Add a transient and go to an entry before the current one.
|
||||
transient_entry = new NavigationEntry(TAB_CONTENTS_WEB);
|
||||
transient_entry->set_url(transient_url);
|
||||
|
||||
@@ -187,7 +187,7 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
|
||||
user_script_dir_path_ = profile->GetUserScriptMaster()->user_script_dir();
|
||||
|
||||
prefs_->AddPrefObserver(prefs::kAcceptLanguages, this);
|
||||
prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
|
||||
prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
|
||||
|
||||
NotificationService::current()->AddObserver(
|
||||
this, NotificationType::EXTENSIONS_LOADED,
|
||||
|
||||
@@ -36,7 +36,7 @@ class MockProxyResolver : public net::ProxyResolver {
|
||||
results->UseNamedProxy(query_url.host());
|
||||
return net::OK;
|
||||
}
|
||||
|
||||
|
||||
void Block() {
|
||||
is_blocked_ = true;
|
||||
event_.Reset();
|
||||
@@ -78,7 +78,7 @@ struct ResultFuture {
|
||||
bool TimedWaitUntilDone(const base::TimeDelta& max_time) {
|
||||
return completed_.TimedWait(max_time);
|
||||
}
|
||||
|
||||
|
||||
// These fields are only valid after returning from WaitUntilDone().
|
||||
IPC::Message* reply_msg;
|
||||
int error_code;
|
||||
|
||||
@@ -32,7 +32,7 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
|
||||
form_to_save_(form_to_save) {
|
||||
}
|
||||
|
||||
virtual ~SavePasswordInfoBarDelegate() { }
|
||||
virtual ~SavePasswordInfoBarDelegate() { }
|
||||
|
||||
// Overridden from ConfirmInfoBarDelegate:
|
||||
virtual void InfoBarClosed() {
|
||||
@@ -72,7 +72,7 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
|
||||
form_to_save_->PermanentlyBlacklist();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// The PasswordFormManager managing the form we're asking the user about,
|
||||
// and should update as per her decision.
|
||||
@@ -172,7 +172,7 @@ void PasswordManager::DidStopLoading() {
|
||||
if (provisional_save_manager_->IsNewLogin()) {
|
||||
web_contents_->AddInfoBar(
|
||||
new SavePasswordInfoBarDelegate(web_contents_,
|
||||
provisional_save_manager_.release()));
|
||||
provisional_save_manager_.release()));
|
||||
} else {
|
||||
// If the save is not a new username entry, then we just want to save this
|
||||
// data (since the user already has related data saved), so don't prompt.
|
||||
|
||||
@@ -34,7 +34,7 @@ class PasswordManager : public views::LoginModel {
|
||||
const PasswordFormMap& best_matches,
|
||||
const PasswordForm* const preferred_match) const;
|
||||
|
||||
// Notification that the user navigated away from the current page.
|
||||
// Notification that the user navigated away from the current page.
|
||||
// Unless this is a password form submission, for our purposes this
|
||||
// means we're done with the current page, so we can clean-up.
|
||||
void DidNavigate();
|
||||
@@ -59,10 +59,10 @@ class PasswordManager : public views::LoginModel {
|
||||
observer_ = observer;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// Note about how a PasswordFormManager can transition from
|
||||
// pending_login_managers_ to provisional_save_manager_ and the infobar.
|
||||
//
|
||||
//
|
||||
// 1. form "seen"
|
||||
// | new
|
||||
// | ___ Infobar
|
||||
|
||||
@@ -16,7 +16,7 @@ TEST(PageNumberTest, Count) {
|
||||
++page;
|
||||
EXPECT_EQ(1, page.ToInt());
|
||||
EXPECT_NE(printing::PageNumber::npos(), page);
|
||||
|
||||
|
||||
printing::PageNumber page_copy(page);
|
||||
EXPECT_EQ(1, page_copy.ToInt());
|
||||
EXPECT_EQ(1, page.ToInt());
|
||||
|
||||
@@ -373,10 +373,10 @@ void ProfileImpl::InitExtensions() {
|
||||
const CommandLine* command_line = CommandLine::ForCurrentProcess();
|
||||
PrefService* prefs = GetPrefs();
|
||||
bool user_scripts_enabled =
|
||||
command_line->HasSwitch(switches::kEnableUserScripts) ||
|
||||
command_line->HasSwitch(switches::kEnableUserScripts) ||
|
||||
prefs->GetBoolean(prefs::kEnableUserScripts);
|
||||
bool extensions_enabled =
|
||||
command_line->HasSwitch(switches::kEnableExtensions) ||
|
||||
command_line->HasSwitch(switches::kEnableExtensions) ||
|
||||
prefs->GetBoolean(prefs::kEnableExtensions);
|
||||
|
||||
FilePath script_dir;
|
||||
|
||||
@@ -217,7 +217,7 @@ class Profile {
|
||||
|
||||
virtual void ResetTabRestoreService() = 0;
|
||||
|
||||
// This reinitializes the spellchecker according to the current dictionary
|
||||
// This reinitializes the spellchecker according to the current dictionary
|
||||
// language, and enable spell check option, in the prefs.
|
||||
virtual void ReinitializeSpellChecker() = 0;
|
||||
|
||||
@@ -230,7 +230,7 @@ class Profile {
|
||||
//
|
||||
// NOTE: this is invoked internally on a normal shutdown, but is public so
|
||||
// that it can be invoked when the user logs out/powers down (WM_ENDSESSION).
|
||||
virtual void MarkAsCleanShutdown() = 0;
|
||||
virtual void MarkAsCleanShutdown() = 0;
|
||||
|
||||
virtual void InitExtensions() = 0;
|
||||
|
||||
@@ -305,7 +305,7 @@ class ProfileImpl : public Profile,
|
||||
// NotificationObserver implementation.
|
||||
virtual void Observe(NotificationType type,
|
||||
const NotificationSource& source,
|
||||
const NotificationDetails& details);
|
||||
const NotificationDetails& details);
|
||||
|
||||
private:
|
||||
friend class Profile;
|
||||
@@ -316,20 +316,20 @@ class ProfileImpl : public Profile,
|
||||
FilePath GetPrefFilePath();
|
||||
|
||||
void StopCreateSessionServiceTimer();
|
||||
|
||||
|
||||
void EnsureSessionServiceCreated() {
|
||||
GetSessionService();
|
||||
}
|
||||
|
||||
// Initializes the spellchecker. If the spellchecker already exsts, then
|
||||
// it is released, and initialized again. This model makes sure that
|
||||
// it is released, and initialized again. This model makes sure that
|
||||
// spellchecker language can be changed without restarting the browser.
|
||||
// NOTE: This is being currently called in the UI thread, which is OK as long
|
||||
// as the spellchecker object is USED in the IO thread.
|
||||
// The |need_to_broadcast| parameter tells it whether to broadcast the new
|
||||
// spellchecker to the resource message filters.
|
||||
void InitializeSpellChecker(bool need_to_broadcast);
|
||||
|
||||
|
||||
FilePath path_;
|
||||
bool off_the_record_;
|
||||
scoped_ptr<VisitedLinkMaster> visited_link_master_;
|
||||
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
ASSERT_TRUE(file_util::Delete(test_dir_, true));
|
||||
ASSERT_FALSE(file_util::PathExists(test_dir_));
|
||||
}
|
||||
|
||||
|
||||
MessageLoopForUI message_loop_;
|
||||
|
||||
// the path to temporary directory used to contain the test operations
|
||||
|
||||
@@ -20,7 +20,7 @@ class AudioRendererHostTest : public testing::Test {
|
||||
// This task post a task to message_loop_ to do internal destruction on
|
||||
// message_loop_.
|
||||
host_->Destroy();
|
||||
// We need to continue running message_loop_ to complete all destructions.
|
||||
// We need to continue running message_loop_ to complete all destructions.
|
||||
message_loop_->RunAllPending();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
|
||||
bool ret = real_handler_->OnWillRead(request_id, buf, buf_size, min_size);
|
||||
read_buffer_ = *buf;
|
||||
read_buffer_size_ = *buf_size;
|
||||
DCHECK(read_buffer_size_ >= kMaxBytesToSniff * 2);
|
||||
DCHECK(read_buffer_size_ >= kMaxBytesToSniff * 2);
|
||||
bytes_read_ = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/renderer_host/test_render_view_host.h"
|
||||
#include "chrome/browser/tab_contents/navigation_entry.h"
|
||||
|
||||
class RenderViewHostTest : public RenderViewHostTestHarness {
|
||||
};
|
||||
|
||||
// All about URLs reported by the renderer should get rewritten to about:blank.
|
||||
// See RenderViewHost::OnMsgNavigate for a discussion.
|
||||
TEST_F(RenderViewHostTest, FilterAbout) {
|
||||
rvh()->SendNavigate(1, GURL("about:cache"));
|
||||
ASSERT_TRUE(controller_->GetActiveEntry());
|
||||
EXPECT_EQ(GURL("about:blank"), controller_->GetActiveEntry()->url());
|
||||
}
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/renderer_host/test_render_view_host.h"
|
||||
#include "chrome/browser/tab_contents/navigation_entry.h"
|
||||
|
||||
class RenderViewHostTest : public RenderViewHostTestHarness {
|
||||
};
|
||||
|
||||
// All about URLs reported by the renderer should get rewritten to about:blank.
|
||||
// See RenderViewHost::OnMsgNavigate for a discussion.
|
||||
TEST_F(RenderViewHostTest, FilterAbout) {
|
||||
rvh()->SendNavigate(1, GURL("about:cache"));
|
||||
ASSERT_TRUE(controller_->GetActiveEntry());
|
||||
EXPECT_EQ(GURL("about:blank"), controller_->GetActiveEntry()->url());
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
|
||||
// deleted it will delete this out from under the caller.
|
||||
explicit RenderWidgetHostViewMac(RenderWidgetHost* widget);
|
||||
virtual ~RenderWidgetHostViewMac();
|
||||
|
||||
|
||||
RenderWidgetHost* render_widget_host() const { return render_widget_host_; }
|
||||
|
||||
|
||||
base::TimeTicks& whiteout_start_time() { return whiteout_start_time_; }
|
||||
|
||||
|
||||
gfx::NativeView native_view() const { return cocoa_view_; }
|
||||
|
||||
// Implementation of RenderWidgetHostView:
|
||||
|
||||
@@ -142,13 +142,13 @@ void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() {
|
||||
NSEvent* event = [[cocoa_view_ window] currentEvent];
|
||||
if ([event window] != [cocoa_view_ window])
|
||||
return;
|
||||
|
||||
|
||||
NSPoint event_location = [event locationInWindow];
|
||||
NSPoint local_point = [cocoa_view_ convertPoint:event_location fromView:nil];
|
||||
|
||||
|
||||
if (!NSPointInRect(local_point, [cocoa_view_ bounds]))
|
||||
return;
|
||||
|
||||
|
||||
NSCursor* ns_cursor = current_cursor_.GetCursor();
|
||||
[ns_cursor set];
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void RenderWidgetHostViewMac::DidScrollRect(
|
||||
|
||||
[cocoa_view_ scrollRect:[cocoa_view_ RectToNSRect:rect]
|
||||
by:NSMakeSize(dx, -dy)];
|
||||
|
||||
|
||||
gfx::Rect new_rect = rect;
|
||||
new_rect.Offset(dx, dy);
|
||||
gfx::Rect dirty_rect = rect.Subtract(new_rect);
|
||||
@@ -240,7 +240,7 @@ void RenderWidgetHostViewMac::ShutdownHost() {
|
||||
|
||||
- (void)dealloc {
|
||||
delete renderWidgetHostView_;
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ void RenderWidgetHostViewMac::ShutdownHost() {
|
||||
canvas->getTopPlatformDevice().DrawToContext(
|
||||
context, damaged_rect_ns.origin.x, damaged_rect_ns.origin.y,
|
||||
&damaged_rect_cg);
|
||||
|
||||
|
||||
[self unlockFocus];
|
||||
}
|
||||
}
|
||||
@@ -341,13 +341,13 @@ void RenderWidgetHostViewMac::ShutdownHost() {
|
||||
|
||||
- (BOOL)becomeFirstResponder {
|
||||
renderWidgetHostView_->render_widget_host()->Focus();
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder {
|
||||
renderWidgetHostView_->render_widget_host()->Blur();
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
|
||||
int pending_requests() const {
|
||||
return static_cast<int>(pending_requests_.size());
|
||||
}
|
||||
|
||||
|
||||
// Intended for unit-tests only. Returns the memory cost of all the
|
||||
// outstanding requests (pending and blocked) for |render_process_host_id|.
|
||||
int GetOutstandingRequestsMemoryCost(int render_process_host_id) const;
|
||||
@@ -412,7 +412,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
|
||||
// data structures supporting this request (URLRequest object,
|
||||
// HttpNetworkTransaction, etc...).
|
||||
// The value of |cost| is added to the running total, and the resulting
|
||||
// sum is returned.
|
||||
// sum is returned.
|
||||
int IncrementOutstandingRequestsMemoryCost(int cost,
|
||||
int render_process_host_id);
|
||||
|
||||
@@ -508,7 +508,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
|
||||
typedef std::map<ProcessRendererIDs, BlockedRequestsList*> BlockedRequestMap;
|
||||
BlockedRequestMap blocked_requests_map_;
|
||||
|
||||
// Maps the render_process_host_ids to the approximate number of bytes
|
||||
// Maps the render_process_host_ids to the approximate number of bytes
|
||||
// being used to service its resource requests. No entry implies 0 cost.
|
||||
typedef std::map<int, int> OutstandingRequestsMemoryCostMap;
|
||||
OutstandingRequestsMemoryCostMap outstanding_requests_memory_cost_map_;
|
||||
|
||||
@@ -69,7 +69,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
|
||||
virtual void PrepareToDestroy() {}
|
||||
virtual void SetTooltipText(const std::wstring& tooltip_text) {}
|
||||
virtual BackingStore* AllocBackingStore(const gfx::Size& size);
|
||||
|
||||
|
||||
bool is_showing() const { return is_showing_; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -109,11 +109,11 @@ bool LoadRLZLibrary(int directory_key) {
|
||||
|
||||
bool SendFinancialPing(const wchar_t* brand, const wchar_t* lang,
|
||||
const wchar_t* referral, bool exclude_id) {
|
||||
RLZTracker::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
|
||||
RLZTracker::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
|
||||
RLZTracker::CHROME_HOME_PAGE,
|
||||
RLZTracker::NO_ACCESS_POINT};
|
||||
if (!send_ping)
|
||||
return false;
|
||||
return false;
|
||||
return send_ping(RLZTracker::CHROME, points, L"chrome", brand, referral, lang,
|
||||
exclude_id, NULL);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
|
||||
// attempt the ping.
|
||||
if (!RLZTracker::RecordProductEvent(RLZTracker::CHROME,
|
||||
RLZTracker::CHROME_OMNIBOX,
|
||||
RLZTracker::FIRST_SEARCH))
|
||||
RLZTracker::FIRST_SEARCH))
|
||||
omnibox_used_ = true;
|
||||
delete this;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
|
||||
// Dtor is private so the object cannot be created on the stack.
|
||||
~OmniBoxUsageObserver() {
|
||||
NotificationService::current()->RemoveObserver(this,
|
||||
NotificationType::OMNIBOX_OPENED_URL,
|
||||
NotificationType::OMNIBOX_OPENED_URL,
|
||||
NotificationService::AllSources());
|
||||
instance_ = NULL;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class DelayedInitTask : public Task {
|
||||
if (OmniBoxUsageObserver::used()) {
|
||||
RLZTracker::RecordProductEvent(RLZTracker::CHROME,
|
||||
RLZTracker::CHROME_OMNIBOX,
|
||||
RLZTracker::FIRST_SEARCH);
|
||||
RLZTracker::FIRST_SEARCH);
|
||||
}
|
||||
}
|
||||
// Schedule the daily RLZ ping.
|
||||
|
||||
@@ -507,7 +507,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownList) {
|
||||
&full_hashes));
|
||||
|
||||
EXPECT_EQ(full_hashes.size(), static_cast<size_t>(1));
|
||||
EXPECT_EQ(memcmp("12345678901234567890123456789012",
|
||||
EXPECT_EQ(memcmp("12345678901234567890123456789012",
|
||||
&full_hashes[0].hash, sizeof(SBFullHash)), 0);
|
||||
EXPECT_EQ(full_hashes[0].list_name, "goog-phish-shavar");
|
||||
EXPECT_EQ(full_hashes[0].add_chunk_id, 1);
|
||||
@@ -522,11 +522,11 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownList) {
|
||||
&full_hashes));
|
||||
|
||||
EXPECT_EQ(full_hashes.size(), static_cast<size_t>(2));
|
||||
EXPECT_EQ(memcmp("12345678901234567890123456789012",
|
||||
EXPECT_EQ(memcmp("12345678901234567890123456789012",
|
||||
&full_hashes[0].hash, sizeof(SBFullHash)), 0);
|
||||
EXPECT_EQ(full_hashes[0].list_name, "goog-phish-shavar");
|
||||
EXPECT_EQ(full_hashes[0].add_chunk_id, 1);
|
||||
EXPECT_EQ(memcmp("abcdefghijklmnopqrstuvwxyz123457",
|
||||
EXPECT_EQ(memcmp("abcdefghijklmnopqrstuvwxyz123457",
|
||||
&full_hashes[1].hash, sizeof(SBFullHash)), 0);
|
||||
EXPECT_EQ(full_hashes[1].list_name, "goog-malware-shavar");
|
||||
EXPECT_EQ(full_hashes[1].add_chunk_id, 7);
|
||||
@@ -632,7 +632,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestZeroSizeAddChunk) {
|
||||
|
||||
EXPECT_EQ(chunks[1].chunk_number, 2);
|
||||
EXPECT_EQ(chunks[1].hosts.size(), static_cast<size_t>(0));
|
||||
|
||||
|
||||
EXPECT_EQ(chunks[2].chunk_number, 3);
|
||||
EXPECT_EQ(chunks[2].hosts.size(), static_cast<size_t>(1));
|
||||
EXPECT_EQ(chunks[2].hosts[0].host, 0x65666163);
|
||||
|
||||
@@ -870,7 +870,7 @@ bool SafeBrowsingDatabaseBloom::BuildAddPrefixList(SBPair* adds) {
|
||||
}
|
||||
|
||||
bool SafeBrowsingDatabaseBloom::RemoveSubs(
|
||||
SBPair* adds, std::vector<bool>* adds_removed,
|
||||
SBPair* adds, std::vector<bool>* adds_removed,
|
||||
HashCache* add_cache, HashCache* sub_cache, int* subs) {
|
||||
DCHECK(add_cache && sub_cache && subs);
|
||||
|
||||
|
||||
@@ -943,7 +943,7 @@ TEST(SafeBrowsingDatabase, HashCaching) {
|
||||
database->UpdateFinished(true);
|
||||
|
||||
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
EXPECT_EQ(full_hashes.size(), 1U);
|
||||
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
|
||||
@@ -954,7 +954,7 @@ TEST(SafeBrowsingDatabase, HashCaching) {
|
||||
full_hashes.clear();
|
||||
|
||||
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
EXPECT_EQ(full_hashes.size(), 1U);
|
||||
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
|
||||
@@ -986,13 +986,13 @@ TEST(SafeBrowsingDatabase, HashCaching) {
|
||||
database->UpdateFinished(true);
|
||||
|
||||
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
EXPECT_EQ(full_hashes.size(), 0U);
|
||||
|
||||
// There should be one remaining full add.
|
||||
EXPECT_TRUE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
EXPECT_EQ(full_hashes.size(), 1U);
|
||||
EXPECT_EQ(0, memcmp(full_hashes[0].hash.full_hash,
|
||||
@@ -1010,10 +1010,10 @@ TEST(SafeBrowsingDatabase, HashCaching) {
|
||||
lists.clear();
|
||||
|
||||
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad1.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
EXPECT_FALSE(database->ContainsUrl(GURL("http://www.fullevil.com/bad2.html"),
|
||||
&listname, &prefixes, &full_hashes,
|
||||
&listname, &prefixes, &full_hashes,
|
||||
Time::Now()));
|
||||
|
||||
TearDownTestDatabase(database);
|
||||
|
||||
@@ -224,7 +224,7 @@ bool SafeBrowsingService::CheckUrlNew(const GURL& url, Client* client) {
|
||||
bool prefix_match = database_->ContainsUrl(url, &list, &prefix_hits,
|
||||
&full_hits,
|
||||
protocol_manager_->last_update());
|
||||
|
||||
|
||||
UMA_HISTOGRAM_TIMES("SB2.FilterCheck", base::Time::Now() - check_start);
|
||||
|
||||
if (!prefix_match)
|
||||
|
||||
@@ -266,7 +266,7 @@ TEST(SafeBrowsing, HostInfo2) {
|
||||
|
||||
// Checks that if we get a sub chunk with one prefix, then get the add chunk
|
||||
// for that same prefix afterwards, the entry becomes empty.
|
||||
TEST(SafeBrowsing, HostInfo3) {
|
||||
TEST(SafeBrowsing, HostInfo3) {
|
||||
SBHostInfo info;
|
||||
|
||||
// Add a sub prefix.
|
||||
|
||||
@@ -32,7 +32,7 @@ struct PrepopulatedEngine {
|
||||
// someone asks. Only entries which need keywords to auto-track a dynamically
|
||||
// generated search URL should use this.
|
||||
// If the empty string, the engine has no keyword.
|
||||
const wchar_t* const keyword;
|
||||
const wchar_t* const keyword;
|
||||
const char* const favicon_url; // If NULL, there is no favicon.
|
||||
const wchar_t* const search_url;
|
||||
const char* const encoding;
|
||||
@@ -1978,7 +1978,7 @@ const PrepopulatedEngine yahoo_hk = {
|
||||
"UTF-8",
|
||||
// http://history.hk.search.yahoo.com/ac/ac_msearch.php?query={searchTerms}
|
||||
// returns a JSON with key-value pairs. Setting parameters (ot, of, output)
|
||||
// to fxjson, json, or js doesn't help.
|
||||
// to fxjson, json, or js doesn't help.
|
||||
NULL,
|
||||
2,
|
||||
};
|
||||
@@ -2694,12 +2694,12 @@ int CountryCharsToCountryIDWithUpdate(char c1, char c2) {
|
||||
c1 = 'R';
|
||||
c2 = 'S';
|
||||
}
|
||||
|
||||
|
||||
// SPECIAL CASE: Timor-Leste changed from 'TP' to 'TL' in 2002. Windows XP
|
||||
// predates this; we therefore map this value.
|
||||
if (c1 == 'T' && c2 == 'P')
|
||||
c2 = 'L';
|
||||
|
||||
|
||||
return CountryCharsToCountryID(c1, c2);
|
||||
}
|
||||
|
||||
@@ -2711,7 +2711,7 @@ int GeoIDToCountryID(GEOID geo_id) {
|
||||
const int kISOBufferSize = 3; // Two plus one for the terminator.
|
||||
wchar_t isobuf[kISOBufferSize] = { 0 };
|
||||
int retval = GetGeoInfo(geo_id, GEO_ISO2, isobuf, kISOBufferSize, 0);
|
||||
|
||||
|
||||
if (retval == kISOBufferSize &&
|
||||
!(isobuf[0] == L'X' && isobuf[1] == L'X'))
|
||||
return CountryCharsToCountryIDWithUpdate(static_cast<char>(isobuf[0]),
|
||||
@@ -2725,7 +2725,7 @@ int GeoIDToCountryID(GEOID geo_id) {
|
||||
return CountryCharsToCountryID('J', 'E');
|
||||
case 0x3B16: // Isle of Man
|
||||
return CountryCharsToCountryID('I', 'M');
|
||||
|
||||
|
||||
// 'UM' (U.S. Minor Outlying Islands)
|
||||
case 0x7F: // Johnston Atoll
|
||||
case 0x102: // Wake Island
|
||||
@@ -2762,7 +2762,7 @@ int GeoIDToCountryID(GEOID geo_id) {
|
||||
|
||||
int GetCurrentCountryID() {
|
||||
GEOID geo_id = GetUserGeoID(GEOCLASS_NATION);
|
||||
|
||||
|
||||
return GeoIDToCountryID(geo_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ SessionCommand* BaseSessionService::CreateUpdateTabNavigationCommand(
|
||||
std::numeric_limits<SessionCommand::size_type>::max() - 1024;
|
||||
|
||||
int bytes_written = 0;
|
||||
|
||||
|
||||
WriteStringToPickle(pickle, &bytes_written, max_state_size,
|
||||
entry.display_url().spec());
|
||||
|
||||
|
||||
@@ -812,7 +812,7 @@ bool SessionService::CreateTabsAndWindows(
|
||||
// Update the selected navigation index.
|
||||
tab->current_navigation_index =
|
||||
std::max(-1, tab->current_navigation_index - payload.index);
|
||||
|
||||
|
||||
// And update the index of existing navigations.
|
||||
for (std::vector<TabNavigation>::iterator i = tab->navigations.begin();
|
||||
i != tab->navigations.end();) {
|
||||
|
||||
@@ -34,7 +34,7 @@ const size_t TabRestoreService::kMaxEntries = 10;
|
||||
|
||||
// Identifier for commands written to file.
|
||||
// The ordering in the file is as follows:
|
||||
// . When the user closes a tab a command of type
|
||||
// . When the user closes a tab a command of type
|
||||
// kCommandSelectedNavigationInTab is written identifying the tab and
|
||||
// the selected index. This is followed by any number of
|
||||
// kCommandUpdateTabNavigation commands (1 per navigation entry).
|
||||
|
||||
@@ -118,7 +118,7 @@ TEST_F(TabRestoreServiceTest, Basic) {
|
||||
// There should be two entries now.
|
||||
ASSERT_EQ(2, service_->entries().size());
|
||||
|
||||
// Make sure the entry matches
|
||||
// Make sure the entry matches
|
||||
entry = service_->entries().front();
|
||||
ASSERT_EQ(TabRestoreService::TAB, entry->type);
|
||||
tab = static_cast<TabRestoreService::Tab*>(entry);
|
||||
|
||||
@@ -36,7 +36,7 @@ class LinkInfoBarDelegate;
|
||||
// and the delegate is free to clean itself up or reset state, which may have
|
||||
// fatal consequences for the InfoBar that was in the process of opening (or is
|
||||
// now fully opened) -- it is referencing a delegate that may not even exist
|
||||
// anymore.
|
||||
// anymore.
|
||||
// As such, it is generally much safer to dedicate a delegate instance to
|
||||
// AddInfoBar!
|
||||
class InfoBarDelegate {
|
||||
@@ -149,7 +149,7 @@ class LinkInfoBarDelegate : public InfoBarDelegate {
|
||||
// closed now or false if it should remain until the user explicitly closes
|
||||
// it.
|
||||
virtual bool LinkClicked(WindowOpenDisposition disposition) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Overridden from InfoBarDelegate:
|
||||
|
||||
@@ -359,7 +359,7 @@ void InterstitialPage::DidNavigate(
|
||||
|
||||
// The RenderViewHost has loaded its contents, we can show it now.
|
||||
render_view_host_->view()->Show();
|
||||
tab_->set_interstitial_page(this);
|
||||
tab_->set_interstitial_page(this);
|
||||
|
||||
// Notify the tab we are not loading so the throbber is stopped. It also
|
||||
// causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used
|
||||
@@ -409,7 +409,7 @@ void InterstitialPage::Disable() {
|
||||
|
||||
void InterstitialPage::TakeActionOnResourceDispatcher(
|
||||
ResourceRequestAction action) {
|
||||
DCHECK(MessageLoop::current() == ui_loop_) <<
|
||||
DCHECK(MessageLoop::current() == ui_loop_) <<
|
||||
"TakeActionOnResourceDispatcher should be called on the main thread.";
|
||||
|
||||
if (action == CANCEL || action == RESUME) {
|
||||
|
||||
@@ -185,4 +185,4 @@ class InterstitialPage : public NotificationObserver,
|
||||
};
|
||||
|
||||
#endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_
|
||||
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ bool RenderViewContextMenuController::IsItemChecked(int id) const {
|
||||
// Check box for 'Check the Spelling of this field'.
|
||||
if (id == IDC_CHECK_SPELLING_OF_THIS_FIELD)
|
||||
return params_.spellcheck_enabled;
|
||||
|
||||
|
||||
// Don't bother getting the display language vector if this isn't a spellcheck
|
||||
// language.
|
||||
if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) ||
|
||||
@@ -272,7 +272,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
|
||||
if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
|
||||
id < IDC_SPELLCHECK_LANGUAGES_LAST) {
|
||||
const size_t language_number = id - IDC_SPELLCHECK_LANGUAGES_FIRST;
|
||||
SpellChecker::Languages display_languages;
|
||||
SpellChecker::Languages display_languages;
|
||||
SpellChecker::GetSpellCheckLanguagesToDisplayInContextMenu(
|
||||
source_web_contents_->profile(), &display_languages);
|
||||
if (language_number < display_languages.size()) {
|
||||
@@ -281,7 +281,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
|
||||
source_web_contents_->profile()->GetPrefs(), NULL);
|
||||
dictionary_language.SetValue(display_languages[language_number]);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
|
||||
source_web_contents_->profile(),
|
||||
nav_entry,
|
||||
source_web_contents_->GetContentNativeView(),
|
||||
PageInfoWindow::SECURITY);
|
||||
PageInfoWindow::SECURITY);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ bool RenderViewHostManager::ShouldCloseTabOnUnresponsiveRenderer() {
|
||||
// handler later finishes, this call will be ignored because the state in
|
||||
// CrossSiteResourceHandler will already be cleaned up.)
|
||||
current_host()->process()->CrossSiteClosePageACK(
|
||||
pending_render_view_host_->site_instance()->process_host_id(),
|
||||
pending_render_view_host_->site_instance()->process_host_id(),
|
||||
pending_request_id);
|
||||
}
|
||||
return false;
|
||||
@@ -194,7 +194,7 @@ void RenderViewHostManager::OnCrossSiteResponse(int new_render_process_host_id,
|
||||
// means it is not a download or unsafe page, and we are going to perform the
|
||||
// navigation. Thus, we no longer need to remember that the RenderViewHost
|
||||
// is part of a pending cross-site request.
|
||||
pending_render_view_host_->SetHasPendingCrossSiteRequest(false,
|
||||
pending_render_view_host_->SetHasPendingCrossSiteRequest(false,
|
||||
new_request_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
#define CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
|
||||
class NavigationController;
|
||||
|
||||
// Runs the form repost warning dialog. If the user accepts the action, then
|
||||
// it will call Reload on the navigation controller back with check_for_repost
|
||||
// set to false.
|
||||
//
|
||||
// This function is implemented by the platform-specific frontend.
|
||||
void RunRepostFormWarningDialog(NavigationController* nav_controller);
|
||||
|
||||
#endif // CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
#define CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
|
||||
class NavigationController;
|
||||
|
||||
// Runs the form repost warning dialog. If the user accepts the action, then
|
||||
// it will call Reload on the navigation controller back with check_for_repost
|
||||
// set to false.
|
||||
//
|
||||
// This function is implemented by the platform-specific frontend.
|
||||
void RunRepostFormWarningDialog(NavigationController* nav_controller);
|
||||
|
||||
#endif // CHROME_BROWSER_TAB_CONTENTS_REPOST_FORM_WARNING_H_
|
||||
|
||||
@@ -109,7 +109,7 @@ class SiteInstance : public base::RefCounted<SiteInstance> {
|
||||
// this SiteInstance becomes ref counted, by storing it in a scoped_refptr.
|
||||
//
|
||||
// The render process host factory may be NULL. See SiteInstance constructor.
|
||||
//
|
||||
//
|
||||
// TODO(creis): This may be an argument to build a pass_refptr<T> class, as
|
||||
// Darin suggests.
|
||||
static SiteInstance* CreateSiteInstance(Profile* profile);
|
||||
|
||||
@@ -159,7 +159,7 @@ const string16& TabContents::GetTitle() const {
|
||||
NavigationEntry* entry = controller_->GetTransientEntry();
|
||||
if (entry)
|
||||
return entry->GetTitleForDisplay(controller_);
|
||||
|
||||
|
||||
entry = controller_->GetLastCommittedEntry();
|
||||
if (entry)
|
||||
return entry->GetTitleForDisplay(controller_);
|
||||
@@ -597,7 +597,7 @@ void TabContents::SetIsLoading(bool is_loading,
|
||||
NotificationDetails det = details ?
|
||||
Details<LoadNotificationDetails>(details) :
|
||||
NotificationService::NoDetails();
|
||||
NotificationService::current()->Notify(type,
|
||||
NotificationService::current()->Notify(type,
|
||||
Source<NavigationController>(this->controller()),
|
||||
det);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/tab_contents/test_web_contents.h"
|
||||
|
||||
#include "chrome/browser/renderer_host/test_render_view_host.h"
|
||||
|
||||
TestWebContents::TestWebContents(Profile* profile, SiteInstance* instance,
|
||||
RenderViewHostFactory* rvh_factory)
|
||||
: WebContents(profile, instance, rvh_factory, MSG_ROUTING_NONE, NULL),
|
||||
transition_cross_site(false) {
|
||||
}
|
||||
|
||||
TestRenderViewHost* TestWebContents::pending_rvh() {
|
||||
return static_cast<TestRenderViewHost*>(
|
||||
render_manager_.pending_render_view_host_);
|
||||
}
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/tab_contents/test_web_contents.h"
|
||||
|
||||
#include "chrome/browser/renderer_host/test_render_view_host.h"
|
||||
|
||||
TestWebContents::TestWebContents(Profile* profile, SiteInstance* instance,
|
||||
RenderViewHostFactory* rvh_factory)
|
||||
: WebContents(profile, instance, rvh_factory, MSG_ROUTING_NONE, NULL),
|
||||
transition_cross_site(false) {
|
||||
}
|
||||
|
||||
TestRenderViewHost* TestWebContents::pending_rvh() {
|
||||
return static_cast<TestRenderViewHost*>(
|
||||
render_manager_.pending_render_view_host_);
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
#define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
|
||||
#include "chrome/browser/tab_contents/web_contents.h"
|
||||
|
||||
class RenderViewHostFactory;
|
||||
class TestRenderViewHost;
|
||||
|
||||
// Subclass WebContents to ensure it creates TestRenderViewHosts and does
|
||||
// not do anything involving views.
|
||||
class TestWebContents : public WebContents {
|
||||
public:
|
||||
// The render view host factory will be passed on to the
|
||||
TestWebContents(Profile* profile, SiteInstance* instance,
|
||||
RenderViewHostFactory* rvh_factory);
|
||||
|
||||
TestRenderViewHost* pending_rvh();
|
||||
|
||||
// State accessor.
|
||||
bool cross_navigation_pending() {
|
||||
return render_manager_.cross_navigation_pending_;
|
||||
}
|
||||
|
||||
// Overrides WebContents::ShouldTransitionCrossSite so that we can test both
|
||||
// alternatives without using command-line switches.
|
||||
bool ShouldTransitionCrossSite() { return transition_cross_site; }
|
||||
|
||||
// Promote DidNavigate to public.
|
||||
void TestDidNavigate(RenderViewHost* render_view_host,
|
||||
const ViewHostMsg_FrameNavigate_Params& params) {
|
||||
DidNavigate(render_view_host, params);
|
||||
}
|
||||
|
||||
// Promote GetWebkitPrefs to public.
|
||||
WebPreferences TestGetWebkitPrefs() {
|
||||
return GetWebkitPrefs();
|
||||
}
|
||||
|
||||
// Prevent interaction with views.
|
||||
bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host) {
|
||||
// This will go to a TestRenderViewHost.
|
||||
render_view_host->CreateRenderView();
|
||||
return true;
|
||||
}
|
||||
void UpdateRenderViewSizeForRenderManager() {}
|
||||
|
||||
// Set by individual tests.
|
||||
bool transition_cross_site;
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
#define CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
|
||||
#include "chrome/browser/tab_contents/web_contents.h"
|
||||
|
||||
class RenderViewHostFactory;
|
||||
class TestRenderViewHost;
|
||||
|
||||
// Subclass WebContents to ensure it creates TestRenderViewHosts and does
|
||||
// not do anything involving views.
|
||||
class TestWebContents : public WebContents {
|
||||
public:
|
||||
// The render view host factory will be passed on to the
|
||||
TestWebContents(Profile* profile, SiteInstance* instance,
|
||||
RenderViewHostFactory* rvh_factory);
|
||||
|
||||
TestRenderViewHost* pending_rvh();
|
||||
|
||||
// State accessor.
|
||||
bool cross_navigation_pending() {
|
||||
return render_manager_.cross_navigation_pending_;
|
||||
}
|
||||
|
||||
// Overrides WebContents::ShouldTransitionCrossSite so that we can test both
|
||||
// alternatives without using command-line switches.
|
||||
bool ShouldTransitionCrossSite() { return transition_cross_site; }
|
||||
|
||||
// Promote DidNavigate to public.
|
||||
void TestDidNavigate(RenderViewHost* render_view_host,
|
||||
const ViewHostMsg_FrameNavigate_Params& params) {
|
||||
DidNavigate(render_view_host, params);
|
||||
}
|
||||
|
||||
// Promote GetWebkitPrefs to public.
|
||||
WebPreferences TestGetWebkitPrefs() {
|
||||
return GetWebkitPrefs();
|
||||
}
|
||||
|
||||
// Prevent interaction with views.
|
||||
bool CreateRenderViewForRenderManager(RenderViewHost* render_view_host) {
|
||||
// This will go to a TestRenderViewHost.
|
||||
render_view_host->CreateRenderView();
|
||||
return true;
|
||||
}
|
||||
void UpdateRenderViewSizeForRenderManager() {}
|
||||
|
||||
// Set by individual tests.
|
||||
bool transition_cross_site;
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_TAB_CONTENTS_TEST_WEB_CONTENTS_H_
|
||||
|
||||
@@ -1468,7 +1468,7 @@ WebContents::GetLastCommittedNavigationEntryForRenderManager() {
|
||||
return NULL;
|
||||
return controller()->GetLastCommittedEntry();
|
||||
}
|
||||
|
||||
|
||||
bool WebContents::CreateRenderViewForRenderManager(
|
||||
RenderViewHost* render_view_host) {
|
||||
RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host);
|
||||
|
||||
@@ -149,7 +149,7 @@ class TestInterstitialPage : public InterstitialPage {
|
||||
SiteInstance::CreateSiteInstance(tab()->profile()),
|
||||
this, MSG_ROUTING_NONE, NULL);
|
||||
}
|
||||
|
||||
|
||||
virtual void CommandReceived(const std::string& command) {
|
||||
command_received_count_++;
|
||||
}
|
||||
@@ -973,10 +973,10 @@ TEST_F(WebContentsTest, ShowInterstitialOnInterstitial) {
|
||||
// Showing interstitial2 should have caused interstitial1 to go away.
|
||||
EXPECT_TRUE(deleted1);
|
||||
EXPECT_EQ(TestInterstitialPage::CANCELED, state1);
|
||||
|
||||
|
||||
// Let's make sure interstitial2 is working as intended.
|
||||
ASSERT_FALSE(deleted2);
|
||||
EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2);
|
||||
EXPECT_EQ(TestInterstitialPage::UNDECIDED, state2);
|
||||
interstitial2->Proceed();
|
||||
GURL landing_url("http://www.thepage.com");
|
||||
rvh()->SendNavigate(2, landing_url);
|
||||
|
||||
@@ -47,14 +47,14 @@ RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget(
|
||||
DCHECK(!render_widget_host->view());
|
||||
RenderWidgetHostViewMac* view =
|
||||
new RenderWidgetHostViewMac(render_widget_host);
|
||||
|
||||
|
||||
// Fancy layout comes later; for now just make it our size and resize it
|
||||
// with us.
|
||||
NSView* view_view = view->native_view();
|
||||
[cocoa_view_.get() addSubview:view_view];
|
||||
[view_view setFrame:[cocoa_view_.get() bounds]];
|
||||
[view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ void WebContentsViewMac::ForwardMessageToDevToolsClient(
|
||||
const IPC::Message& message) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
void WebContentsViewMac::FindInPage(const Browser& browser,
|
||||
bool find_next, bool forward_direction) {
|
||||
if (!find_bar_.get()) {
|
||||
@@ -228,7 +228,7 @@ void WebContentsViewMac::Observe(NotificationType type,
|
||||
CFRetain(view);
|
||||
[view release];
|
||||
sad_tab_.reset(view);
|
||||
|
||||
|
||||
// Set as the dominant child.
|
||||
[cocoa_view_.get() addSubview:view];
|
||||
[view setFrame:[cocoa_view_.get() bounds]];
|
||||
|
||||
@@ -154,7 +154,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) {
|
||||
if (!first_in_group)
|
||||
return std::wstring();
|
||||
return IntToWString(base::GetProcId(resource->GetProcess()));
|
||||
|
||||
|
||||
case kGoatsTeleportedColumn: // Goats Teleported.
|
||||
goats_teleported_ += rand();
|
||||
return FormatNumber(goats_teleported_);
|
||||
@@ -264,7 +264,7 @@ HANDLE TaskManagerTableModel::GetProcessAt(int index) {
|
||||
|
||||
void TaskManagerTableModel::StartUpdating() {
|
||||
DCHECK_NE(TASK_PENDING, update_state_);
|
||||
|
||||
|
||||
// If update_state_ is STOPPING, it means a task is still pending. Setting
|
||||
// it to TASK_PENDING ensures the tasks keep being posted (by Refresh()).
|
||||
if (update_state_ == IDLE) {
|
||||
@@ -546,7 +546,7 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
|
||||
int proc2_id = base::GetProcId(resources_[row2]->GetProcess());
|
||||
return ValueCompare<int>(proc1_id, proc2_id);
|
||||
}
|
||||
|
||||
|
||||
case kGoatsTeleportedColumn:
|
||||
return 0; // Don't bother, numbers are random.
|
||||
|
||||
@@ -846,7 +846,7 @@ void TaskManagerContents::Layout() {
|
||||
y() + kPanelVertMargin,
|
||||
width() - 2 * kPanelHorizMargin,
|
||||
height() - 2 * kPanelVertMargin - prefered_height);
|
||||
|
||||
|
||||
// y-coordinate of button top left.
|
||||
gfx::Rect parent_bounds = GetParent()->GetLocalBounds(false);
|
||||
int y_buttons = parent_bounds.bottom() - prefered_height - kButtonVEdgeMargin;
|
||||
|
||||
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário